Advertisement
Guest User

Freeform mode (Android 9.0+)

a guest
Jun 17th, 2020
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. // From android.app.WindowConfiguration
  2. final int WINDOWING_MODE_FREEFORM = 5;
  3.  
  4. ActivityOptions options = ActivityOptions.makeBasic();
  5. options.setLaunchBounds(new Rect(0, 0, 500, 500));
  6.  
  7. try {
  8.     Method method = ActivityOptions.class.getMethod("setLaunchWindowingMode", int.class);
  9.     method.invoke(options, WINDOWING_MODE_FREEFORM);
  10. } catch (Exception e) { /* handle exception */ }
  11.  
  12. // Now, call startActivity(intent, options.toBundle());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement