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;








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.










share|improve this question






























    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.










    share|improve this question


























      0












      0








      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 24 '16 at 20:06









      Yabin SongYabin Song

      1942 gold badges4 silver badges18 bronze badges




      1942 gold badges4 silver badges18 bronze badges

























          3 Answers
          3






          active

          oldest

          votes


















          1














           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






          share|improve this answer

























          • 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











          • 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



















          1














          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






          share|improve this answer
































            0














            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.






            share|improve this answer



























              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
              );



              );













              draft saved

              draft discarded


















              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









              1














               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






              share|improve this answer

























              • 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











              • 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
















              1














               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






              share|improve this answer

























              • 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











              • 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














              1












              1








              1







               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






              share|improve this answer













               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







              share|improve this answer












              share|improve this answer



              share|improve this answer










              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, 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











              • 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


















              • 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











              • 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

















              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














              1














              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






              share|improve this answer





























                1














                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






                share|improve this answer



























                  1












                  1








                  1







                  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






                  share|improve this answer













                  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







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 25 '16 at 21:25









                  Fletcher WangFletcher Wang

                  361 bronze badge




                  361 bronze badge
























                      0














                      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.






                      share|improve this answer





























                        0














                        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.






                        share|improve this answer



























                          0












                          0








                          0







                          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.






                          share|improve this answer













                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 27 at 12:29









                          Bernardo do Amaral TeodosioBernardo do Amaral Teodosio

                          61 bronze badge




                          61 bronze badge






























                              draft saved

                              draft discarded
















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현