See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More
( 5 months ago )

Android: Custom listview on a fragment gets concatenated to previously appearing one, once created i want it to display the saved instance only

Course Queries Syllabus Queries
Max. 2000 characters

Nicola Aley


( 5 months ago )

Everytime I go to some other fragment of my app Oncreate is called again and list duplicates itself. I'm a newbee to android soo it would be great to have some detailed solutions.

This is my Java code for the fragment:

public class Fragment_notice extends Fragment {
private static final String TAG = MainActivity2.class.getSimpleName();
private static final String STATE_NOTICE ="state_notice" ;
private ListView listView;
private JSONObject jobj;
private NoticeAdapter listAdapter;
int count=0;
ArrayList<NoticeItem> originalValues = new ArrayList<NoticeItem>();
private List<NoticeItem> feedItems;

private String URL_FEED = "";
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v=inflater.inflate(R.layout.noticereal_layout,container, false);
    listView = (ListView) v.findViewById(;
    if (savedInstanceState !=null)
        listAdapter = new NoticeAdapter(getActivity(), feedItems);
    else {

        feedItems = new ArrayList<NoticeItem>();

        listAdapter = new NoticeAdapter(getActivity(), feedItems);

        // We first check for cached request
        ConnectionDetector cd = new ConnectionDetector(getActivity());

        Boolean isInternetPresent = cd.isConnectingToInternet();
        Cache cache = AppController.getInstance().getRequestQueue().getCache();

        Cache.Entry entry = cache.get(URL_FEED);
        if (!isInternetPresent) {
            AlertDialog showAlertDialog;
            showAlertDialog(getActivity(), "No Internet Connection",
                    "You don't have internet connection.", false);


what's your interest