Restarting an activity in a single tab in a TabActivity?

后端 未结 4 587
渐次进展
渐次进展 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条回答
  •  -上瘾入骨i
    2020-12-29 16:46

    Here is the solution:

    tabHost.setOnTabChangedListener(this);
    public void onTabChanged(String tabId) {
            Log.d(LOG_KEY, tabId);
            LocalActivityManager manager = getLocalActivityManager();
            manager.destroyActivity("ID_1", true);
            manager.startActivity("ID_1", new Intent(this, YourMyActivity.class));
        }
    

提交回复
热议问题