So I have a class that extends a Fragment, which in it, I have a FragmentTabHost, my FragmentTabHost consist of 3 Tab, each tab will show a list of item.. Inside each item I can update the item property like its name/ other property. My problem is after I update the value and pressed back button, my list of item is still consist the old list where my item value isn't updated. My list is updated only if I switch to another tab and go back again. I've been struggling for couple of hours with this problem, any help will be much appreciated Thanks
package com.example.hansel.tapbandung_v00.page.Menu_Parent;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTabHost;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.example.hansel.tapbandung_v00.R;
import com.example.hansel.tapbandung_v00.page.submenu_bus.bus_category;
import com.example.hansel.tapbandung_v00.page.submenu_bus.bus_featured;
import com.example.hansel.tapbandung_v00.page.submenu_bus.bus_newest;
/**
* Created by Hansel on 5/25/2015.
*/
public class Business_parent extends Fragment{
private FragmentTabHost mTabHost;
Context context;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = getActivity().getApplicationContext();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
//3 tab category, dll
mTabHost = new FragmentTabHost(getActivity());
mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.tabhost);
mTabHost.addTab(mTabHost.newTabSpec("featured").setIndicator("Featured"),
bus_featured.class, null);
mTabHost.addTab(mTabHost.newTabSpec("category").setIndicator("Category"),
bus_category.class, null);
mTabHost.addTab(mTabHost.newTabSpec("newest").setIndicator("Newest"),
bus_newest.class, null);
return mTabHost;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onDestroyView() {
super.onDestroyView();
mTabHost = null;
}
}