views:

132

answers:

1

Maybe my question might seem a bit weird, but I have an activity in which, in one case , I have to move to another activity before it finishes loading the screen. My condition is in the onCreate method, which means when I encounter it, i get a "startActivity called from outside an activity context" error and the app just crashes...
But then, is there an easy way like a flag for the intent to make it work without having the activity context resolved? thanks for any answer

A: 

I dont think it's possible to switch to another activity during the onCreate method of a starting activity. But why you just doesn't draw any GUI before deciding if you have to start the other activity?

Roflcoptr
you mean doing my testing before I change activity and then fire the intent only if the test is ok?
Sephy
No I'm talking of doing your testing after the activity is loaded but before the GUI is drawn. Or what do you mean by "before finishes loading the screen"? Isn't that before the GUI is drawn?
Roflcoptr
I don't understand the "after the activity is loaded but before the GUI is drawn". an activity can be loaded and intent fired from it without any GUI displayed???
Sephy
Ok can you edit your post and post some code?
Roflcoptr
actually i did my testing before sending the intent so I don't have the issue anymore. thanks for pointing the idea.
Sephy