user2779837
user2779837

Reputation: 311

Add multiple flags to windowmanager

I have a WindowManager params set up like this:

  final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
        WindowManager.LayoutParams.FILL_PARENT,
        WindowManager.LayoutParams.WRAP_CONTENT,
        WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, 
        WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
        PixelFormat.TRANSLUCENT );

However, this is causing an error. It's fine if I remove on of the flags, but I want both. How can I do this?

Upvotes: 2

Views: 2549

Answers (1)

flx
flx

Reputation: 14226

Use a bit-wise OR for your flags to combine them bitwise: flag1 | flag2

final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
    WindowManager.LayoutParams.FILL_PARENT,
    WindowManager.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | 
    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
    PixelFormat.TRANSLUCENT );

Upvotes: 4

Related Questions