Author
how to switch from one activity to another activity
sohaib rahman
Greenhorn
Joined: Jun 01, 2010
Posts: 20
Hi folks!
I have come with a new problem. The problem is that there is a Welcome Screen which has a start button. I want to switch from WelcomeScreen Activity to another Activity on the click of the Start button. I anyone has an example then please reply me.
Aris Doxakis
Ranch Hand
Joined: Dec 05, 2004
Posts: 132
good morning,
use this on the clickListener function to open a new activity
//Open new activity
Intent myIntent = new Intent();
myIntent.setClassName("com.yourDomain.appName", "com.yourDomain.appName.activityName");
startActivity(myIntent);
you can pass parameters to the new activity if you use
myIntent.putExtra();
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32768
posted May 25, 2011 23:32:37
0
That's what Intents are for. The "Activating Components" section of the "Application Fundamentals" page in the SDK Dev Guide talks about that.
Android apps – ImageJ plugins – Java web charts
Espen Myklevoll
Greenhorn
Joined: Apr 26, 2011
Posts: 2
This is only a personal preference, but I feel that this keeps things nice and clean
In your other activity, add this method:
Then you can call this activity from your WelcomeScreen activity, or any other class simply by running this:
Mayu Mayooresan
Ranch Hand
Joined: Mar 12, 2011
Posts: 35
calling new activiy and sending data with Intent is easy
check out this Small Tutorial
subject: how to switch from one activity to another activity