开发者

Intent at startup

开发者 https://www.devze.com 2023-02-10 12:05 出处:网络
I am trying to write this snippit into my onCreate method. But the issue I think is that when the program is first opened it will not have this intent sent to it. It is basicly so I can navigate from

I am trying to write this snippit into my onCreate method. But the issue I think is that when the program is first opened it will not have this intent sent to it. It is basicly so I can navigate from the home screen to another and when you come back it changes accordingly. At the moment though on startup it forces the application to close.

Intent inten = getIntent();
Bundle b = inten.getExtras();
int newText 开发者_开发百科= b.getInt("NEXTQUESTION");


why don't you just check if b is null? something like:

int newText;
if(b == null) {
    newText = FIRSTQUESTION;
} else {
    newText = b.getInt("NEXTQUESTION");
}

anyway if I understood well, it's going to pile up a lot of activities in the task stack, because you're not finish()'ing them, but calling every time a new one, right? I don't know if it's good:

For the default "standard" mode, a new instance is created to respond to every new intent.

0

精彩评论

暂无评论...
验证码 换一张
取 消