-1

I am a beginner in Android. I would like to create an App which opens a navigation drawer activity when a button is clicked. I started the project with an empty activity with only a button as my MainActivity. Then I added new navigation drawer activity with all the default codes generated by Android Studio. I tried to search for ways to start the navigation drawer activity when my button in main activity is clicked but I couldn't find any of it. Can anyone help me please?

Calvin Low
  • 35
  • 1
  • 3
  • 1
    It doesn't matter what kind of activity it is. You just call `context.startActivity(new Intent(context, SecondActivity.class));` on your button click – ᴛʜᴇᴘᴀᴛᴇʟ May 14 '16 at 14:28
  • 1
    Come on bro, this is a lame question. – Vucko May 14 '16 at 14:31
  • according to google design guidelines you should open your navigation drawer when menu icon in action bar is clicked or it should be fixed. but it is not recommended to open it on button click inside another activity – Mrugesh May 14 '16 at 14:43

1 Answers1

1

Use Intent method

Intent intent = new Intent(yourCurrentActivity.this,yourNavigrationDrawerActivityName.class);
startActivity(intent);
Vishwesh Jainkuniya
  • 2,821
  • 3
  • 18
  • 35