Tuesday, January 3, 2012

[android-developers] How to use setFlags?

Hi,

I'm trying to set certain flags for some of my windows, and I'm not
sure how to do it. The Window.setFlags()documentation says the
following:

public void setFlags (int flags, int mask)
Since: API Level 1

Set the flags of the window, as per the WindowManager.LayoutParams
flags.

Note that some flags must be set before the window decoration is
created (by the first call to setContentView(View,
android.view.ViewGroup.LayoutParams) or getDecorView():
FLAG_LAYOUT_IN_SCREEN and FLAG_LAYOUT_INSET_DECOR. These will be set
for you based on the windowIsFloating attribute.
Parameters
flags The new window flags (see WindowManager.LayoutParams).
mask Which of the window flag bits to modify.

I know that flags refers to all the flag constants defined in
WindowManager.LayoutParams, but I'm not sure what the the mask is. All
example code I've seen so far have identical flags and mask.

I tried a few flags by myself, with the following code in the
onCreate() method of the activity:

super.onCreate(savedInstanceState)
Window w = this.getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
w.setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);
setContentView(R.layout.myLayout);

FLAG_FULLSCREEN is supposed to remove all decorations on the screen
and make the window fulls screen. This works.
FLAG_SECURE is supposed to disable screenshots from being taken. This
doesn't work, as I'm still able to take screen shots via DDMS.

May I know what I'm doing wrongly here?

Thanks.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate