Is there any way to replace the main layout in the navigation drawer with the Activity which extends AppCombatActivity not the Fragment.
Because whenever I do so it gives me the error that : Wrong 2nd argument type. Found:'myapp.hp.com.drawerdemo1.Main2Activity', required:'android.support.v4.app.Fragment' replace(int,android.support.v4.app.Fragment)in FragmentTransaction cannot be applied to(int,myapp.hp.com.drawerdemo1.Main2Activity)
I was doing this :
if (id == R.id.nav_start) {
// Handle the camera action
getSupportActionBar().setTitle(name);
Main2Activity main = new Main2Activity();
android.support.v4.app.FragmentTransaction fragmentTransaction =
getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.Fragment_Layout, main);
fragmentTransaction.commit();
}
Point to be noted : I don't need intent activity as it opens up the activity in the other layout which doesn't look much interactive.
What is the reason I want the activity layout instead of fragment layout :
- In the class which extends Fragment its hard to perform and handle different action like button click and so on.
- Difficult to initialize different events.
- Main reason is that I'm naive at handling Fragments.
Please help as I need it. I'll appreciate if you will look forward to this problem and give me a solution. Thank You..:)