Steve Steve - 6 months ago 14
Android Question

What do debug and packageName fields actually do?

I was looking through Google documentation about WindowManager.LayoutParams (https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html) and found there 2 fields : packagename and debug. Can someone explain me how to work with them? Something like this,right?

WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.debug("debug");
params.packageName = "some package";


Then where should see "debug" string? And this params will be used only when some app with package name "some package" is running?

Thank you.

Answer

Then where should see "debug" string?

Anywhere you want, reading API:

Stringdebug(String output)

Returns a String representation of this set of layout parameters.

Just:

                                 // not sure if layoutname is correct value!
System.out.println(params.debug("layoutname"));

or

                                   // not sure if layoutname is correct value!
Log.d("debugString", params.debug("layoutname"));

Will return a String with the following format: output + "ViewGroup.LayoutParams={ width=WIDTH, height=HEIGHT }"

And this params will be used only when some app with package name "some package" is running?

Actually no, packagename is an attribute and you dont have permissions to change it.