Howto start a new activity in Android Studio


Activity in Android studio represent a Window, where you can dispplay controls and handle data etc. You can start as many form/activity the project requires. Just add a new Activity and do the following

Here we goes

  • Create a Intenet object, the first parameter will be the package or Main activity and the second will be the new new activity class
  • Call the startActivity method

Code

Intent intent = new Intent(MainActivity.this, NewActivity.class);
startActivity(intent);

Note: Can also possible to run as many activity with in a activity using the concept Fragment (Learn More about Fragments )
I hope this will help you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.