Code_Yoga
Code_Yoga

Reputation: 3278

Android- Implement 'Show Touches' programmatically

Recent Versions of Android have a feature named 'Show Touches' in 'Settings->Developer Options', enabling which shows a visual feedback for touch interactions.

Is there a way to programmatically implement it in my app. I mean, show visual feedback when user touches a screen on my app (irrespective of the system settings)

Upvotes: 2

Views: 4294

Answers (4)

patel8786
patel8786

Reputation: 121

To enable show touches:

Settings.System.putInt(context.getContentResolver(),"show_touches", 1);

To disable show touches:

Settings.System.putInt(context.getContentResolver(),"show_touches", 0);

Remember to add android.permission.WRITE_SETTINGS to your AndroidManifest.xml.

Source

Upvotes: 0

user5244621
user5244621

Reputation:

To enable:

 Settings.System.putInt(context.getContentResolver(),
                "show_touches", 1);

To Disable:

 Settings.System.putInt(context.getContentResolver(),
                "show_touches", 0);

works on below marshmallow version. must add <uses-permission android:name="android.permission.WRITE_SETTINGS" /> to manifest.

Upvotes: 1

Sam
Sam

Reputation: 4643

I am actually looking for the same thing as you do.

I dont find any source so far but you may be interested in checking this site.

I believe this function is implementable.

https://code.google.com/p/android-touchexample/

Upvotes: 1

mDroidd
mDroidd

Reputation: 1233

There is a way to do that: create an overlay which can receive touch events. But then you will not be able to use the background anymore (e.g. the app you're using).

So actually it's not possible, unfortunately. If I'm not mistaking, it's because Google wants to prevent something called TapJacking.

I'm sorry!

Upvotes: 0

Related Questions