I created a navigation drawer. Now,navigation drawer requires all fragments. I want to send some information and move to this fragment which contains drawer from an activity. How do I implement this ? I am using Intent(activityclass.this,fragment.class)
for navigation and putExtra
for sending data. But the app crashes.
Asked
Active
Viewed 338 times
0

Nikhil Khurana
- 422
- 1
- 5
- 12
-
Maybe you need a good sample code. If you want your existing code fix, pls post them, the relevant ones. – The Original Android Jul 31 '15 at 20:18
2 Answers
0
Fragments are not loaded using Intent. You need to use FragmentManager:
Fragment fragment = new MyFragment();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.container,fragment).commit();

Maha Benabbou
- 183
- 4
0
your approach needs some modification i would like to refer the below links for better ways

raktale
- 465
- 3
- 12