I want to show a black screen in the task manager preview under Ice Cream Sandwich, like the German 'finanzstatus' app does. It would be nice if someone could point me in the right direction.
Asked
Active
Viewed 2,459 times
5

Darshan Rivka Whittle
- 32,989
- 7
- 91
- 109

MOST2K2
- 255
- 4
- 14
-
1. Could you point us to a picture of what you want to achieve for better understanding. 2. Why would you want to do that? If one app would do that, as a user I wouldn't see that as a feature, more as a bug. – KarlKarlsom Apr 02 '12 at 23:39
-
here is the picture: [link](http://imageshack.us/photo/my-images/818/taskmanagero.png), i want to do that because i have sensitive data in my app (personal data). i do an automatic logout if the user suspend the app (running in background). – MOST2K2 Apr 03 '12 at 04:12
-
I have right now no equipment to write a small test program but as much I remember the snapshot is taken at the moment you activity is paused. I would give it a try and override the onPause function and alter the view in there. And first after the view is altered call the original onPause – KarlKarlsom Apr 03 '12 at 04:50
-
I have the same problem: if you have found a solution, can you please post it? thx! – MADMap Apr 10 '12 at 08:18
-
2Yes you need to add flag.secure to the windowmanager. But be careful at android version < 3! – MOST2K2 Jun 01 '12 at 16:52
1 Answers
9
Using FLAG_SECURE
will block your app from screenshots, including the recent tasks list:
public class FlagSecureTestActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(LayoutParams.FLAG_SECURE,
LayoutParams.FLAG_SECURE);
setContentView(R.layout.main);
}
}

CommonsWare
- 986,068
- 189
- 2,389
- 2,491