Haseeb Jadoon
Haseeb Jadoon

Reputation: 450

Refresh all fragments content after returning from another activity

I have a drop down (connected with db) in every fragment (4 fragments in one fragment activity).

Problem is that when I come back from AddNew intent the drop down list still contains the previous data. All I want is to refresh the data in drop down(s).

I have tried writing the following code but it gets stuck in a loop calling it self again and again.

public void OnResume()
{
    super.onResume();
    this.finish();
    startActivity(getIntent());
}

Upvotes: 0

Views: 893

Answers (1)

Yash Sampat
Yash Sampat

Reputation: 30601

You need to call notifyDataSetChanged() on the Adapters of your Fragments when you want to refresh the data.

Upvotes: 1

Related Questions