如何重新加载TabView中存在的Activity?

时间:2010-08-02 21:39:47

标签: android view refresh tabs

我有一个带有3个标签的Tabview(每个标签都有自己的活动)。我有一个分析RSS提要的选项卡。如何通过菜单按钮刷新此Feed?我尝试了以下操作但当然失去了上面的标签。谢谢!

  Intent UpdateFeedIntent = new Intent(classA.this, classA.class);

startActivity(UpdateFeedIntent);    光洁度();

2 个答案:

答案 0 :(得分:3)

答案 1 :(得分:-1)

感谢Justin的链接。在尝试了许多不同的方法后,我终于开始工作了。 (尽可能地缩短它,但是为了减少混淆,可以写实际的代码。)

ListAdapter adapter;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(SavedInstanceState);
    rssparser();
    adapter = new MyCustomAdapter(this, R.layout.list_item, rsstitles);
    setListAdapter(adapter);
}

public void onResume() {
    super.onResume();

    rsstitles.clear();  // this line is what finally got the notifyDataSetChanged() to work

    rssparser();
    ((MyCustomAdapter) adapter).notifyDataSetChanged();
    setListAdapter(getListAdapter());
}

如果其中一些看起来很有趣只是评论。这里可能有一些不必要的东西,还不确定是否要开始测试其他一些东西。感谢Justin的链接!