How to refresh Fragment

SabariSankarSabariSankar INMember ✭✭

Hi All,

I have an issue in rendering/refreshing fragment.I have used Detach and Attach method for refreshing fragment.But not refreshing/displaying the fragment.Please anyone suggest me.

I have done the following steps.
**
My code snippet is below**

var transaction= FragmentManager.BeginTransaction();
if(FragmentManager.FindFragmentByTag("FragmentName")==null)
{
MyFragment fragment= new MyFragment();
transaction.Add(Resource.Id.HomeFrameLayout, fragment);
transaction.Commit();
break;
}
else
{
transaction.Detach(FragmentManager.FindFragmentByTag("FragmentName"));
transaction.Attach(FragmentManager.FindFragmentByTag("FragmentName"));
transaction.Commit();
}

Thanks in Advance
SabariSankar

Answers

  • mikeacostamikeacosta USUniversity ✭✭✭

    You'll probably have better luck asking in the Xamarin Android forum. Are you trying to update data in a list? If so, a couple things search for:

    • BaseAdapter and NotifyDataSetChanged();
    • Data binding and MVVM (more complex)
  • SabariSankarSabariSankar INMember ✭✭

    Thanks for reply.And i will try and update you soon.

Sign In or Register to comment.