Skip to content

Instantly share code, notes, and snippets.

@cesarferreira
Created October 18, 2015 09:26
Show Gist options
  • Select an option

  • Save cesarferreira/298d7e420cc85c2d0f88 to your computer and use it in GitHub Desktop.

Select an option

Save cesarferreira/298d7e420cc85c2d0f88 to your computer and use it in GitHub Desktop.
[android] Adding views to services (yes, it's possible)
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams windowParams = new WindowManager.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams. WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
windowManager.addView(listView, windowParams);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment