Reputation: 27
I am trying to move from one activity to another activity. But some times seems it is hanging. On screen off and On it is working fine. eg: I am in Activity 1 Moved from Activity 1 to Activity 2 Seems it is hanged. But if I do screen off and on it is on Activity 1.
Below is my Code sample:
Intent i;
i = new Intent(AdvSeatAvail.this, TrainsBetweenTwoStationsList.class);
i.putExtra("anim id in", R.anim.fragment_slide_right_enter);
i.putExtra("anim id out", R.anim.fragment_slide_left_exit);
i.putExtra("jsonvalue", jsonvalue);
i.putExtra("dateval", dateval);
AdvSeatAvail.this.finish();
AdvSeatAvail.this.startActivity(i);
overridePendingTransition(R.anim.fragment_slide_right_enter, R.anim.fragment_slide_left_exit);
Some one please help me to resolve this Issue.
-- thanks, Kiran
Upvotes: 0
Views: 121
Reputation: 894
Try this:
finish();
Intent i = new Intent(AdvSeatAvail.this, TrainsBetweenTwoStationsList.class);
/* putExtra stuff */
startActivity(i);
Hopefuly it will help.
Upvotes: 0
Reputation: 8042
Use below lines of code for it.. Firstly call another activity than finish the class
Intent i;
i = new Intent(AdvSeatAvail.this, TrainsBetweenTwoStationsList.class);
i.putExtra("anim id in", R.anim.fragment_slide_right_enter);
i.putExtra("anim id out", R.anim.fragment_slide_left_exit);
i.putExtra("jsonvalue", jsonvalue);
i.putExtra("dateval", dateval);
AdvSeatAvail.this.startActivity(i); //// FIRTLY START THE CLASS AND THAN FINISH THE CLASS
AdvSeatAvail.this.finish();
overridePendingTransition(R.anim.fragment_slide_right_enter, R.anim.fragment_slide_left_exit);
Upvotes: 1