Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving from One activity to next in Android

Tags:

android

I am developing an application in android which has a login Screen. Right now I am able to receive the response from the server successfully. After a successful response it should take me to the next activity or class where I display a new screen/activity. what should I do in order to achieve this.

like image 440
Niamathsa Avatar asked Sep 27 '10 11:09

Niamathsa


People also ask

How can we redirect from one activity to another?

You need to use Intent Class in order to redirect from one activity class to another activity class. onOptionsItemSelected() Method will be trigged when you click the 'show setting' menu in the action bar.


1 Answers

In Android you are using Intents to change from one Activity to another. In this case you would use an explicit Intent. In code this would like this:

Intent goToNextActivity = new Intent(getApplicationContext(), YourNewClass.class);
startActivity(goToNextActivity);

Be sure to add YourNewClass to the manifest as another activity like this:

<activity android:name=".your.package.YourNewClass" />

Have a closer look at the documentation of Intent. You can also read the document about application fundamentals in the documentation it is somewhat to deep to just answer this question but it will give you insights in the most important concepts of android.

like image 121
Janusz Avatar answered Sep 18 '22 13:09

Janusz