I'm developing an app that uses fragment.
In one of these fragments I retrieve data from a remote server and populate a listview.
But I noticed that if a user inserts a new value and then goes back to the fragment it doesn't show it.
The fragment shows the new value only after the user closes and reopens the app...
How can I solve it? I need a way to refresh the fragment every time the user swipes and views it...
This is the code:
public class Page2Fragment extends Fragment { TestImmagineAdapter adp2; Archivio archivio; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // fragment not when container null if (container == null) { return null; } // inflate view from layout View view = (LinearLayout)inflater.inflate(R.layout.page2,container,false); ListView mylist = (ListView) view.findViewById(R.id.listView); archivio = new Archivio(); adp2 = new TestImmagineAdapter(archivio.retTitle(), archivio.retArt(), this.getActivity().getApplicationContext()); mylist.setAdapter(adp2); /*mylist.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent service = new Intent(view.getContext(), Web.class); service.putExtra("href", archivio.getLink(position)); startActivity(service); // TODO Auto-generated method stub } });*/ return view; } }