+ 1
Please tell me 🙏
How to open a new fragment from an activity by clicking on a button?
1 Antwort
+ 4
I think your problem is basic, there are already several lessons and topic out there to explain all this in detail, You need more information and do study about fragments.
First you need to create a fragment placeholder(<Frame layout>).
//Inside click listener
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction(); transaction.add(ID_OF_YOUR_FRAMELAYOUT,YOUR_FRAGMENT_NAME,YOUR_FRAGMENT_STRING_TA);
transaction.addToBackStack(null); transaction.commit();
);