0

I am trying to create a WindowManager with some LayoutParams,create an activity and attach the latter to it.

I know I could create the activity first and then get the Window in which it was created and then apply the parameters like so

myActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

But can it be done the other way around?

m4r0ck
  • 21
  • 5
  • You should never be instantiating Activities yourself with `new`. It will not work. Android needs to do additional setup with the Activity before it can function properly, and there's no way for you to do that instead of the OS. – Karakuri Jul 28 '15 at 01:15
  • I am not instantiating activities with `new`, I create a new intent and after that I do some additional work in onCreate(). I've also tried to do what is on my previous question here http://stackoverflow.com/questions/31302883/dismissing-a-custom-incoming-call-screen-on-android-when-the-call-is-answered-or by calling `wm.addView(ly, params);` but I am not able to get onCreate() executed because I am inflating a view only which is less than what I want to perform. – m4r0ck Jul 28 '15 at 09:21

0 Answers0