How can I reload an Activity that exists in a TabView?

I have a tab with three tabs (each of which has its own activity). I have a tab that parses an RSS feed. How can I update this channel using the menu button? I tried the following, but of course I am losing tabs. Thank!

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

startActivity (UpdateFeedIntent); finish ();

+3
source share
2 answers

. , , . ( , , .)

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!

-1

Source: https://habr.com/ru/post/1757738/


All Articles