Android : how to navigate from a activity to a fragment

on Monday, September 15, 2014


initially on click of an item in my navigation drawer,I am on a fragment (Question_Fragment),I am checking that is this fragment is called for the first time??? if it is for the first time i need some selections from users,for that i am moving to that activity where user will select options from spinners,when user inputs are done on button click i want to some asynctask(this task will store user inputs into database) then want to return to the fragment(Question_Fragment).on returning of the fragment i want updated contents...


I have tried calling Question_fragment on post execute of my asynktask,



Fragment frag = new Question_Fragment();
android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
//ft.add(R.id.activity_lin, frag);
ft.replace(R.id.activity_lin, frag);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.addToBackStack(null);
ft.commit();


but on my activities layout,fragment contents are been added...i just simply want to go that fragment.


0 comments:

Post a Comment