Simply fallow undermentioned and let me know if you have any issues regarding same. I faced this problem:-
(1) Define a boolean value with value "false".
(2) Now when you are done with fetching data then simply change it to true.
(3) Now when you render back to any screen that have downloaded data simply check that value to be true/false. you will check same on OnCreateView. If value is false then let AsyncTask be run else wise don't allow AsyncTask to run.
For ex:
<
if(vivek != true){
new GoAsyncTask().execute();
}else{
gaa = new GoArrayAdapter(getActivity(), m_ArrayList);
lv = (ListView) rootView.findViewById(R.id.go_list);
lv.setVisibility(View.VISIBLE);
lv.setAdapter(gaa);
lv.setOnItemClickListener(new OnItemClickListener() {
@SuppressWarnings("static-access")
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
dh.open();
dh.updateSeenStatus(m_ArrayList.get(arg2).postid, 1);
dh.close();
m_ArrayList.get(arg2).isSeen = true;
GoDetail fragment = new GoDetail();
Bundle bundle = new Bundle();
bundle.putString("title", m_ArrayList.get(arg2).title);
bundle.putString("excert", m_ArrayList.get(arg2).excert);
bundle.putString("description", m_ArrayList.get(arg2).description);
bundle.putString("thumsrc", m_ArrayList.get(arg2).thumsrc);
bundle.putString("header_title", "Go");
//bundle.putInt("postid", m_ArrayList.get(arg2).postid);
fragment.setArguments(bundle);
((BaseContainerFragment)getParentFragment()).replaceFragment(fragment, true);
}
});
}
>