android - how to add two fragments in one activity -


android: have list fragment on activity.based on choice, fragment shown on same activity other fragment should replaced , don't know how when list fragment fixed !

from google guide replacing fragments : http://developer.android.com/training/basics/fragments/fragment-ui.html

// create fragment , give argument specifying article should show articlefragment newfragment = new articlefragment(); bundle args = new bundle(); args.putint(articlefragment.arg_position, position); newfragment.setarguments(args);  fragmenttransaction transaction = getsupportfragmentmanager().begintransaction();  // replace whatever in fragment_container view fragment, // , add transaction stack user can navigate transaction.replace(r.id.fragment_container, newfragment); transaction.addtobackstack(null);  // commit transaction transaction.commit(); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -