开发者

android launch modes

In my android application i am using standard launch mode for all activities.In my application i have a footer bar开发者_开发技巧 with home icon to navigate to homescreen from any application activity.the home screen is getting created that many times.If i place the launch mode as single instance the same activity is popped up but even if the data i am expecting is different it is popping up the same data with initial data.

Please let me know as how can i get new activity created only if there is change of data.

Please forward me your valuable suggestions


singleInstance mode means that first time, when activity is created, onCreate() will be called. However on subsequent invocations onNewIntent() is called instead.

So you should override onNewIntent() and reload the data and update the display there.


You can also try this:

final Intent i = new Intent(this, HomeActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);

This way, the onCreate of your HomeActivity will run again.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜