how to detect accessibility settings on android is enabled/disabledProgrammatically how to Turn Off Triple Tap to Zoom on Android ActivityCan the accessibility “Magnification Gesture” be detected on Android?How to save an Android Activity state using save instance state?Disable landscape mode in Android?How to check if a service is running on Android?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I pass data between Activities in Android application?How do I display an alert dialog on Android?Detect whether there is an Internet connection available on AndroidHow do I rotate the Android emulator display?How to get the build/version number of your Android application?How to manage startActivityForResult on Android?
Output with the same length always
global variant of csname…endcsname
How to train a replacement without them knowing?
Scam? Phone call from "Department of Social Security" asking me to call back
What if a restaurant suddenly cannot accept credit cards, and the customer has no cash?
The space of cusp forms for GL_2 over F_q(T)
How does the Moon's gravity affect Earth's oceans despite Earth's stronger gravitational pull?
Minimum population for language survival
Does writing regular diary entries count as writing practice?
Eric Andre had a dream
Why don't modern jet engines use forced exhaust mixing?
What exactly happened to the 18 crew members who were reported as "missing" in "Q Who"?
Did Michelle Obama have a staff of 23; and Melania have a staff of 4?
What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?
Adding things to bunches of things vs multiplication
I was dismissed as a candidate for an abroad company after disclosing my disability
Quick destruction of a helium filled airship?
What are the advantages of this gold finger shape?
What should I do if actually I found a serious flaw in someone's PhD thesis and an article derived from that PhD thesis?
How can I enter recovery mode (for Mac OS, on an iMac) remotely?
Has there ever been a truly bilingual country prior to the contemporary period?
When did Bilbo and Frodo learn that Gandalf was a Maia?
Why do so many people play out of turn on the last lead?
What is the fastest way to level past 95 in Diablo II?
how to detect accessibility settings on android is enabled/disabled
Programmatically how to Turn Off Triple Tap to Zoom on Android ActivityCan the accessibility “Magnification Gesture” be detected on Android?How to save an Android Activity state using save instance state?Disable landscape mode in Android?How to check if a service is running on Android?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I pass data between Activities in Android application?How do I display an alert dialog on Android?Detect whether there is an Internet connection available on AndroidHow do I rotate the Android emulator display?How to get the build/version number of your Android application?How to manage startActivityForResult on Android?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm particularly interested in high contrast text
, color correction
, and magnification
settings. I did some research online, couldn't find what I want. I saw one answer about detecting high contrast text
:
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean isHighTextContrastEnabled = am.isHighTextContrastEnabled();
But somehow it gives me the error for isHighTextContrastEnabled()
saying that it is undefined for the type AccessibilityManager.
Also didn't find solution for the other two settings detection.
android
add a comment |
I'm particularly interested in high contrast text
, color correction
, and magnification
settings. I did some research online, couldn't find what I want. I saw one answer about detecting high contrast text
:
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean isHighTextContrastEnabled = am.isHighTextContrastEnabled();
But somehow it gives me the error for isHighTextContrastEnabled()
saying that it is undefined for the type AccessibilityManager.
Also didn't find solution for the other two settings detection.
android
add a comment |
I'm particularly interested in high contrast text
, color correction
, and magnification
settings. I did some research online, couldn't find what I want. I saw one answer about detecting high contrast text
:
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean isHighTextContrastEnabled = am.isHighTextContrastEnabled();
But somehow it gives me the error for isHighTextContrastEnabled()
saying that it is undefined for the type AccessibilityManager.
Also didn't find solution for the other two settings detection.
android
I'm particularly interested in high contrast text
, color correction
, and magnification
settings. I did some research online, couldn't find what I want. I saw one answer about detecting high contrast text
:
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
boolean isHighTextContrastEnabled = am.isHighTextContrastEnabled();
But somehow it gives me the error for isHighTextContrastEnabled()
saying that it is undefined for the type AccessibilityManager.
Also didn't find solution for the other two settings detection.
android
android
asked May 24 '16 at 20:06
Yabin SongYabin Song
1942 gold badges4 silver badges18 bronze badges
1942 gold badges4 silver badges18 bronze badges
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
Class clazz = am.getClass();
Method m = null;
try
m = clazz.getMethod("isHighTextContrastEnabled",null);
catch (NoSuchMethodException e)
Log.w("FAIL", "isHighTextContrastEnabled not found in AccessibilityManager");
Object result = null;
try
result = m.invoke(am, null);
if (result != null && result instanceof Boolean)
Boolean b = (Boolean)result;
Log.d("result", "b =" + b);
catch (Exception e)
android.util.Log.d("fail", "isHighTextContrastEnabled invoked with an exception" + e.getMessage());
return;
and I do test, it return false, so it works
It works perfectly. Thanks a lot! I didn't find official interface for detecting the other 2 attributes,magnification
, andcolor correction
. Do you happen to know are they accessible?
– Yabin Song
May 25 '16 at 18:32
Just read Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED for magnification enabled, it may need permission "android.permission.READ_SECURE_SETTINGS" , not sure about color correction, it is a boolean settings or something else?
– Fletcher Wang
May 25 '16 at 19:04
It is a boolean. And I don't seeSettings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED
exist.... Is it my SDK has some issue or something? Shouldn't be though, I have everything installed and updated..
– Yabin Song
May 25 '16 at 19:25
ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED is also hidden, can not access directly, here is how to read it: try int i = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_magnification_enabled"); Log.w("TAG", "i = " + i); catch (Exception e) Log.w("FAIL", "accessibility_display_magnification_enabled :" + e.getMessage());
– Fletcher Wang
May 25 '16 at 20:33
add a comment |
use this for color correction:
int color_correction_enabled = 0;
try
color_correction_enabled = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_daltonizer_enabled");
catch (Exception e)
color_correction_enabled = 0; // means default false
add a comment |
What a did was
private fun checkForAcessibility(): Boolean
try
val accessibilityManager = context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
val accessibilityManagerClass = accessibilityManager.javaClass
val isHighTextContrastEnabledMethod = accessibilityManagerClass.getMethod("isHighTextContrastEnabled")
val result: Any = isHighTextContrastEnabledMethod.invoke(accessibilityManager) ?: return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
if (result !is Boolean)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
return if (result)
AccessibilityEnabledValue.TRUE
else
AccessibilityEnabledValue.FALSE
catch (e: Exception)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
enum class AccessibilityEnabledValue(val value: String)
TRUE("true"),
FALSE("false"),
ERROR_QUERYING_VALUE("error_querying_value")
I've noticed that isHighTextContrastEnabled()
method does not contain parameters.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37422895%2fhow-to-detect-accessibility-settings-on-android-is-enabled-disabled%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
Class clazz = am.getClass();
Method m = null;
try
m = clazz.getMethod("isHighTextContrastEnabled",null);
catch (NoSuchMethodException e)
Log.w("FAIL", "isHighTextContrastEnabled not found in AccessibilityManager");
Object result = null;
try
result = m.invoke(am, null);
if (result != null && result instanceof Boolean)
Boolean b = (Boolean)result;
Log.d("result", "b =" + b);
catch (Exception e)
android.util.Log.d("fail", "isHighTextContrastEnabled invoked with an exception" + e.getMessage());
return;
and I do test, it return false, so it works
It works perfectly. Thanks a lot! I didn't find official interface for detecting the other 2 attributes,magnification
, andcolor correction
. Do you happen to know are they accessible?
– Yabin Song
May 25 '16 at 18:32
Just read Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED for magnification enabled, it may need permission "android.permission.READ_SECURE_SETTINGS" , not sure about color correction, it is a boolean settings or something else?
– Fletcher Wang
May 25 '16 at 19:04
It is a boolean. And I don't seeSettings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED
exist.... Is it my SDK has some issue or something? Shouldn't be though, I have everything installed and updated..
– Yabin Song
May 25 '16 at 19:25
ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED is also hidden, can not access directly, here is how to read it: try int i = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_magnification_enabled"); Log.w("TAG", "i = " + i); catch (Exception e) Log.w("FAIL", "accessibility_display_magnification_enabled :" + e.getMessage());
– Fletcher Wang
May 25 '16 at 20:33
add a comment |
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
Class clazz = am.getClass();
Method m = null;
try
m = clazz.getMethod("isHighTextContrastEnabled",null);
catch (NoSuchMethodException e)
Log.w("FAIL", "isHighTextContrastEnabled not found in AccessibilityManager");
Object result = null;
try
result = m.invoke(am, null);
if (result != null && result instanceof Boolean)
Boolean b = (Boolean)result;
Log.d("result", "b =" + b);
catch (Exception e)
android.util.Log.d("fail", "isHighTextContrastEnabled invoked with an exception" + e.getMessage());
return;
and I do test, it return false, so it works
It works perfectly. Thanks a lot! I didn't find official interface for detecting the other 2 attributes,magnification
, andcolor correction
. Do you happen to know are they accessible?
– Yabin Song
May 25 '16 at 18:32
Just read Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED for magnification enabled, it may need permission "android.permission.READ_SECURE_SETTINGS" , not sure about color correction, it is a boolean settings or something else?
– Fletcher Wang
May 25 '16 at 19:04
It is a boolean. And I don't seeSettings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED
exist.... Is it my SDK has some issue or something? Shouldn't be though, I have everything installed and updated..
– Yabin Song
May 25 '16 at 19:25
ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED is also hidden, can not access directly, here is how to read it: try int i = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_magnification_enabled"); Log.w("TAG", "i = " + i); catch (Exception e) Log.w("FAIL", "accessibility_display_magnification_enabled :" + e.getMessage());
– Fletcher Wang
May 25 '16 at 20:33
add a comment |
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
Class clazz = am.getClass();
Method m = null;
try
m = clazz.getMethod("isHighTextContrastEnabled",null);
catch (NoSuchMethodException e)
Log.w("FAIL", "isHighTextContrastEnabled not found in AccessibilityManager");
Object result = null;
try
result = m.invoke(am, null);
if (result != null && result instanceof Boolean)
Boolean b = (Boolean)result;
Log.d("result", "b =" + b);
catch (Exception e)
android.util.Log.d("fail", "isHighTextContrastEnabled invoked with an exception" + e.getMessage());
return;
and I do test, it return false, so it works
AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
Class clazz = am.getClass();
Method m = null;
try
m = clazz.getMethod("isHighTextContrastEnabled",null);
catch (NoSuchMethodException e)
Log.w("FAIL", "isHighTextContrastEnabled not found in AccessibilityManager");
Object result = null;
try
result = m.invoke(am, null);
if (result != null && result instanceof Boolean)
Boolean b = (Boolean)result;
Log.d("result", "b =" + b);
catch (Exception e)
android.util.Log.d("fail", "isHighTextContrastEnabled invoked with an exception" + e.getMessage());
return;
and I do test, it return false, so it works
answered May 25 '16 at 18:11
Fletcher WangFletcher Wang
361 bronze badge
361 bronze badge
It works perfectly. Thanks a lot! I didn't find official interface for detecting the other 2 attributes,magnification
, andcolor correction
. Do you happen to know are they accessible?
– Yabin Song
May 25 '16 at 18:32
Just read Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED for magnification enabled, it may need permission "android.permission.READ_SECURE_SETTINGS" , not sure about color correction, it is a boolean settings or something else?
– Fletcher Wang
May 25 '16 at 19:04
It is a boolean. And I don't seeSettings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED
exist.... Is it my SDK has some issue or something? Shouldn't be though, I have everything installed and updated..
– Yabin Song
May 25 '16 at 19:25
ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED is also hidden, can not access directly, here is how to read it: try int i = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_magnification_enabled"); Log.w("TAG", "i = " + i); catch (Exception e) Log.w("FAIL", "accessibility_display_magnification_enabled :" + e.getMessage());
– Fletcher Wang
May 25 '16 at 20:33
add a comment |
It works perfectly. Thanks a lot! I didn't find official interface for detecting the other 2 attributes,magnification
, andcolor correction
. Do you happen to know are they accessible?
– Yabin Song
May 25 '16 at 18:32
Just read Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED for magnification enabled, it may need permission "android.permission.READ_SECURE_SETTINGS" , not sure about color correction, it is a boolean settings or something else?
– Fletcher Wang
May 25 '16 at 19:04
It is a boolean. And I don't seeSettings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED
exist.... Is it my SDK has some issue or something? Shouldn't be though, I have everything installed and updated..
– Yabin Song
May 25 '16 at 19:25
ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED is also hidden, can not access directly, here is how to read it: try int i = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_magnification_enabled"); Log.w("TAG", "i = " + i); catch (Exception e) Log.w("FAIL", "accessibility_display_magnification_enabled :" + e.getMessage());
– Fletcher Wang
May 25 '16 at 20:33
It works perfectly. Thanks a lot! I didn't find official interface for detecting the other 2 attributes,
magnification
, and color correction
. Do you happen to know are they accessible?– Yabin Song
May 25 '16 at 18:32
It works perfectly. Thanks a lot! I didn't find official interface for detecting the other 2 attributes,
magnification
, and color correction
. Do you happen to know are they accessible?– Yabin Song
May 25 '16 at 18:32
Just read Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED for magnification enabled, it may need permission "android.permission.READ_SECURE_SETTINGS" , not sure about color correction, it is a boolean settings or something else?
– Fletcher Wang
May 25 '16 at 19:04
Just read Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED for magnification enabled, it may need permission "android.permission.READ_SECURE_SETTINGS" , not sure about color correction, it is a boolean settings or something else?
– Fletcher Wang
May 25 '16 at 19:04
It is a boolean. And I don't see
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED
exist.... Is it my SDK has some issue or something? Shouldn't be though, I have everything installed and updated..– Yabin Song
May 25 '16 at 19:25
It is a boolean. And I don't see
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED
exist.... Is it my SDK has some issue or something? Shouldn't be though, I have everything installed and updated..– Yabin Song
May 25 '16 at 19:25
ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED is also hidden, can not access directly, here is how to read it: try int i = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_magnification_enabled"); Log.w("TAG", "i = " + i); catch (Exception e) Log.w("FAIL", "accessibility_display_magnification_enabled :" + e.getMessage());
– Fletcher Wang
May 25 '16 at 20:33
ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED is also hidden, can not access directly, here is how to read it: try int i = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_magnification_enabled"); Log.w("TAG", "i = " + i); catch (Exception e) Log.w("FAIL", "accessibility_display_magnification_enabled :" + e.getMessage());
– Fletcher Wang
May 25 '16 at 20:33
add a comment |
use this for color correction:
int color_correction_enabled = 0;
try
color_correction_enabled = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_daltonizer_enabled");
catch (Exception e)
color_correction_enabled = 0; // means default false
add a comment |
use this for color correction:
int color_correction_enabled = 0;
try
color_correction_enabled = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_daltonizer_enabled");
catch (Exception e)
color_correction_enabled = 0; // means default false
add a comment |
use this for color correction:
int color_correction_enabled = 0;
try
color_correction_enabled = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_daltonizer_enabled");
catch (Exception e)
color_correction_enabled = 0; // means default false
use this for color correction:
int color_correction_enabled = 0;
try
color_correction_enabled = Settings.Secure.getInt(this.getContentResolver(), "accessibility_display_daltonizer_enabled");
catch (Exception e)
color_correction_enabled = 0; // means default false
answered May 25 '16 at 21:25
Fletcher WangFletcher Wang
361 bronze badge
361 bronze badge
add a comment |
add a comment |
What a did was
private fun checkForAcessibility(): Boolean
try
val accessibilityManager = context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
val accessibilityManagerClass = accessibilityManager.javaClass
val isHighTextContrastEnabledMethod = accessibilityManagerClass.getMethod("isHighTextContrastEnabled")
val result: Any = isHighTextContrastEnabledMethod.invoke(accessibilityManager) ?: return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
if (result !is Boolean)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
return if (result)
AccessibilityEnabledValue.TRUE
else
AccessibilityEnabledValue.FALSE
catch (e: Exception)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
enum class AccessibilityEnabledValue(val value: String)
TRUE("true"),
FALSE("false"),
ERROR_QUERYING_VALUE("error_querying_value")
I've noticed that isHighTextContrastEnabled()
method does not contain parameters.
add a comment |
What a did was
private fun checkForAcessibility(): Boolean
try
val accessibilityManager = context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
val accessibilityManagerClass = accessibilityManager.javaClass
val isHighTextContrastEnabledMethod = accessibilityManagerClass.getMethod("isHighTextContrastEnabled")
val result: Any = isHighTextContrastEnabledMethod.invoke(accessibilityManager) ?: return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
if (result !is Boolean)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
return if (result)
AccessibilityEnabledValue.TRUE
else
AccessibilityEnabledValue.FALSE
catch (e: Exception)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
enum class AccessibilityEnabledValue(val value: String)
TRUE("true"),
FALSE("false"),
ERROR_QUERYING_VALUE("error_querying_value")
I've noticed that isHighTextContrastEnabled()
method does not contain parameters.
add a comment |
What a did was
private fun checkForAcessibility(): Boolean
try
val accessibilityManager = context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
val accessibilityManagerClass = accessibilityManager.javaClass
val isHighTextContrastEnabledMethod = accessibilityManagerClass.getMethod("isHighTextContrastEnabled")
val result: Any = isHighTextContrastEnabledMethod.invoke(accessibilityManager) ?: return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
if (result !is Boolean)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
return if (result)
AccessibilityEnabledValue.TRUE
else
AccessibilityEnabledValue.FALSE
catch (e: Exception)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
enum class AccessibilityEnabledValue(val value: String)
TRUE("true"),
FALSE("false"),
ERROR_QUERYING_VALUE("error_querying_value")
I've noticed that isHighTextContrastEnabled()
method does not contain parameters.
What a did was
private fun checkForAcessibility(): Boolean
try
val accessibilityManager = context.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
val accessibilityManagerClass = accessibilityManager.javaClass
val isHighTextContrastEnabledMethod = accessibilityManagerClass.getMethod("isHighTextContrastEnabled")
val result: Any = isHighTextContrastEnabledMethod.invoke(accessibilityManager) ?: return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
if (result !is Boolean)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
return if (result)
AccessibilityEnabledValue.TRUE
else
AccessibilityEnabledValue.FALSE
catch (e: Exception)
return AccessibilityEnabledValue.ERROR_QUERYING_VALUE
enum class AccessibilityEnabledValue(val value: String)
TRUE("true"),
FALSE("false"),
ERROR_QUERYING_VALUE("error_querying_value")
I've noticed that isHighTextContrastEnabled()
method does not contain parameters.
answered Mar 27 at 12:29
Bernardo do Amaral TeodosioBernardo do Amaral Teodosio
61 bronze badge
61 bronze badge
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37422895%2fhow-to-detect-accessibility-settings-on-android-is-enabled-disabled%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown