Search code examples
androidandroid-screen

How to display Image on top of every view in android (eg. Like cracked screen app in market)


I want to create something like Better Cracked Screen.

The cracked screen remains top of everything.

I am not able to get how to make such thing which resides top of everything.

Behavior : For example when cracked screen is displayed, and if i press home button then it shows me the home but the cracked screen remains as it is(here on top of home).. doesnot matter whereever you move.. cracked screen appears intact..

Search Results so far : Google API Demos : Translucent GLSurfaceView

Can anyone guide me how can i achieve this task ? Or can anyone please provide me a sample code for this ?


Solution

  • Use android.permission.SYSTEM_ALERT_WINDOW.

    That will allow you to create a window that is placed on top of all application windows. A key insight to have here is that you can not work on a View level to solve this. A View hierarchy is drawn inside a window, so to place something on top of all windows, you need another window.