0
我有一项活动。在我启动一个片段时,每次启动片段时都应该获得不同的图像。如何在每次启动单个碎片时更改映像?
public void onNavigationDrawerItemSelected(int position) {
// update the main content by replacing fragments
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.container, PlaceholderFragment.newInstance(position + 1)).commit();
}
public void onSectionAttached(int number) {
switch (number) {
case 1:
// mTitle = getString(R.string.title_section1);
break;
case 2:
// mTitle = getString(R.string.title_section2);
break;
case 3:
//`enter code here` mTitle = getString(R.string.title_section3);
break;
}
}