Ken Gordon
Newbie
How do I call a Navigation Drawer Activity from the Main Activity? When loaded on a Android device, the button doesn't work.
I apologize for my vagueness. In all the tutorials I've looked at, they had the main activity be the navigation drawer, which makes sense for a tutorial. What I want to do is different. From the main activity I want to start another activity from which you utilize the drawer rather than have access to it from the main activity. Main Activity--loads Main2Activity--Access Navigation drawer.
I thought all I had to do was to use Intent to start the activity, but the button does take me to the NavigationActivity, it doesn't go anywhere. That is the crux of my problem. Can anyone help. Thanks!
Code:
public class MainActivity extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void GO()
{
Button GoButton=findViewById(R.id.buttonGo);
GoButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(MainActivity.this, NavigationActivity.class);
startActivity(intent);
}
});
}
}
I apologize for my vagueness. In all the tutorials I've looked at, they had the main activity be the navigation drawer, which makes sense for a tutorial. What I want to do is different. From the main activity I want to start another activity from which you utilize the drawer rather than have access to it from the main activity. Main Activity--loads Main2Activity--Access Navigation drawer.
I thought all I had to do was to use Intent to start the activity, but the button does take me to the NavigationActivity, it doesn't go anywhere. That is the crux of my problem. Can anyone help. Thanks!
Last edited: