0

I have an activity1(inside a tabhost) that will call another activity(activity2) when an event happens. And the activity2 will call another activity(activity3) when other event happen. Then the activity2 and 3 will finish() themselves and go back to activity1. My problem is, if I am on activity1, and press the back button, activitiy1 will get destory() properly, which make sense. But when I trigger events and go to activity2 or activity3, then finish the event and go back to activity1, then when I press back button, the activity1 didn't get destory() properly, so next time when i enter my app again, it will crash.

Here is my codes:

activity1:

public void onClick(View v)
            {
Intent feedbackintent = new Intent(StartActivity.this,   //activity1 calling activity2
                        FeedBackActivity.class);

                    startActivity(feedbackintent);

activity2:

public void onClick(View v)
            {
                Intent intent2 = new Intent(FeedBackActivity.this, //act2 called act3, and finish act2 itself
                        SaveNewRecord.class);
                startActivity(intent2);
                finish();
            }

activity3:

savesomething...()  //act3 do something and finish itself and go back to act1
finish();
4

0 回答 0