Android: Starting a Child Activity from a Parent Activity

by jmorris 29. June 2010 23:07

Despite my early mistakes, starting an Activity to launch a child view off of the main view is pretty simple in Android ;) First define an activity that will act as the parent, in most platforms this is analogous to a "main" method which indicates the starting point for the application and a child Activity that the will be activated from this Activity:

Then create an intent passing in a reference to the current Activity and the class definition of the child Activity. Finally pass the newly created Intent into the startActivity(...) method. Simple ;)

Tags: , , ,

Java | Android

Comments (2) -

Ashik India
8/18/2010 6:39:12 AM #

Dude! If U start intent in child which runs parent_activity.class..then stack goes on increasing as both call eachother and it will be a disaster at last!!

jmorris United States
8/22/2010 5:05:19 PM #

@Ashik - Can you explain that in more detail? What is a better example of how to do this?

Jeff Morris

Tag cloud

Month List

Page List