Geralt_Encore
Geralt_Encore

Reputation: 3771

Android starting new activity

I have a strange problem in my android application. I am starting one activity from another and the starting code is right, I know it. It works about one or two times of the four launches. Reason, because it is failing that when the second activity is starting, suddenly starting the first and I don't know why, because I don't call this activity. The second activity is exactly right. Can anyone give me some reason of calling the first activity again?
I will not show code, because it too big. I can show parts, that will be interesting for you, if anybody asks it. Thanks a lot and sorry for my english. I really need your help

Activity launching:

Bundle b = new Bundle();
b.putString("id", ids.get(2));
b.putString("auth", auths.get(2));
Intent intent = new Intent(getApplicationContext(), ProfileLoaderActivity.class);
intent.putExtras(b);
startActivity(intent);

Second activity is right because it works well, when I call it from another activities

Upvotes: 0

Views: 985

Answers (1)

rogermushroom
rogermushroom

Reputation: 5586

There are limited possibilities about what might actually be happening.

A possibility if with the first activity at the top of the activity stack, you launch the second activity which crashes on start up, that activity is then destroyed/dies revealing the original activity.

Other possibilities are you are unintentionally calling the wrong activity or that the first activity is getting called from another component altogether.

You can try pressing the back button when then first activity incorrectly is present, if the second activity is present when you press back you know that the second activity was launched and that something somewhere is calling on the first activity again. You could then look at the intent that was calling it for further information. If the second activity isn't present you are either calling the wrong activity from the off or you second activity isn't being created correctly.

Upvotes: 3

Related Questions