重新启动在一个TabActivity单个标签的活动? [英] Restarting an activity in a single tab in a TabActivity?

查看:145
本文介绍了重新启动在一个TabActivity单个标签的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TabActivity。每个标签指向一个子活动。这个伟大的工程。

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

有什么聪明的方法来刷新活动标签之一?我只是想'重启'的标签#3例如活动。不知道的好办法做到这一点以外的其他刷新支持建设以活动本身,或清除所有选项卡并重新创建所有的人。

Is there any clever way to refresh one of the activity tabs? I just want to 'restart' the activity in tab #3 for example. Not sure of a good way to do this other than building in refresh support to the activity itself, or clearing ALL the tabs and recreating all of them.

谢谢

推荐答案

略多于动态的解决方案:

Slightly more dynamic solution:

LocalActivityManager manager = getLocalActivityManager();
String currentTag = tabHost.getCurrentTabTag();
Class<? extends Activity> currentClass = manager.getCurrentActivity().getClass();
manager.destroyActivity(currentTag, true);
manager.startActivity(currentTag, new Intent(this, currentClass));

这篇关于重新启动在一个TabActivity单个标签的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆