/ Published in: Java
2 option for onIconSelect
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
@Override Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.content_layout); Fragment newFragment = null; newFragment = createFragment("fr.vogue.adresses.android." + fragment); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (currentFragment == null) { transaction.add(R.id.content_layout, newFragment); } else { transaction.remove(currentFragment).add(R.id.content_layout, newFragment); } transaction.addToBackStack(null); transaction.commit(); } Fragment newFragment = null; try { newFragment = (Fragment) Class.forName(fragment).newInstance(); // TODO Auto-generated catch block e.printStackTrace(); // TODO Auto-generated catch block e.printStackTrace(); // TODO Auto-generated catch block e.printStackTrace(); } return newFragment; }