aspose file tools*
The moose likes Android and the fly likes how to switch from one activity to another activity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "how to switch from one activity to another activity" Watch "how to switch from one activity to another activity" New topic
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: 136

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: 41896
    
  63
That's what Intents are for. The "Activating Components" section of the "Application Fundamentals" page in the SDK Dev Guide talks about that.


Ping & DNS - my free Android networking tools app
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: 37

calling new activiy and sending data with Intent is easy

check out this Small Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to switch from one activity to another activity