Restarting an activity in a single tab in a TabActivity?

后端 未结 4 598
渐次进展
渐次进展 2020-12-29 16:06

I have a TabActivity. Each tab point to a sub activity. This works great.

Is there any clever way to refresh one of the activity tabs? I just want to \'restart\' th

4条回答
  •  遥遥无期
    2020-12-29 16:49

    You can restart the Activity by setting flag. The code is as below.

    spec = tabHost  .newTabSpec("tab1")
                    .setIndicator("FirstActivity")
                    .setContent(new Intent(this,MyFirstActivity.class)
                    .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
    tabHost.addTab(spec);
    

提交回复
热议问题