1

I've reviewed this thread on how to get the current status of the 'High Contrast Text' mode by calling : isHighTextContrastEnabled from within AccessibilityManager.

See this thread: Detect if 'High contrast' is enabled in Android accessibility settings

Is there a way one can use AccessibilityManager to enable the 'Hight Contrast Text' mode from within an application?

Looking at the available methods I didn't see anything.

Community
  • 1
  • 1
GIZNAJ
  • 501
  • 5
  • 23
  • 1
    What about `/** * Sets the current state and notifies listeners, if necessary. * * @param stateFlags The state flags. */ private void setStateLocked(int stateFlags) {` That uses the `stateFlags` for setting `final boolean highTextContrastEnabled = (stateFlags & STATE_FLAG_HIGH_TEXT_CONTRAST_ENABLED) != 0;` – Abhijeet May 24 '16 at 02:03
  • I don't fully understand some of the context of your answer ( "That uses the stateFlags for setting" ) – GIZNAJ May 24 '16 at 02:35
  • @Abhijeet - can you elaborate with contextual example? – GIZNAJ May 24 '16 at 15:38
  • I am able to successfully get the status of the High Contrast Text boolean value, but I am not able to set it yet. The method is private and I'm wondering if I have to use reflection or not? – GIZNAJ May 29 '16 at 23:54
  • I now have the following code but I am getting a "no method exception". What do you think? – GIZNAJ Jun 11 '16 at 01:39
  • AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE); Class accessibilityClass = am.getClass(); Method m1 = null; Method m2 = null; try { m1 = accessibilityClass.getDeclaredMethod("setStateLocked",null); m2 = accessibilityClass.getMethod("setStateLocked",null); } catch (NoSuchMethodException e) { Toast.makeText(getApplicationContext(), "No such method", Toast.LENGTH_SHORT).show(); – GIZNAJ Jun 11 '16 at 01:39

0 Answers0