Title: Starting Activities in Android
Tags: android;android-layout;android-intent
Question: I'm a newbie in Android after Googling I found if you want to call another activity you have to use
Intent intent = new Intent(getBaseContext(), Activity_Name.class);
//if Any Extra
//intent.putExtra("", "");
intent.putExtra("EmpID", EmpID);
startActivity(intent);   `
Now this is a standard approach but if you refer to the image. I'm lopping almost 20 times in the ListView (Activity1).
Now what I belive that this keeps adding again and again as my app crashes later on without any proper reason and not at any particular location.
I have disable the back button on the DataCollection Screens (Activity 2, 3,4)
Hence its a pure Waterfall approach.
Any suggestion. Should I add  finish(); line in the last screen
Intent intent = new Intent(getBaseContext(), Activity_Name.class);
//if Any Extra
//intent.putExtra("", "");
intent.putExtra("EmpID", EmpID);
startActivity(intent);
finish();   `
So that it dies and goes to the previous and that dies and goes to the previous. And later landing on the ListView.
Would that be a good approach. Or is there anything where I can just call another activity like this but the system should forget all the previous activity information.
Comment: so are you going to prevent before creating many instances of the same activity?

Here is the accepted answer: Or is there anything where I can just call another activity like this
but the system should forget all the previous activity information
Have a look at Intent Flags, e.g.FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_CLEAR_TOP.

Here is another answer: If you dont want the user to go backwards, finish the current activity just after starting a new one.
after
startActivity(intent);
finish();
If you'd like to clear the activity stack, when going to a particiluar activity find it your manifest (like "Activity 1") and add the attribute android:clearTaskOnLaunch="true"
more info here : http://developer.android.com/guide/topics/manifest/activity-element.html#clear

Here is another answer: You are probably better of using startActivityForResult rather startActivity. Then, when you call an activity you know that when it finishes it will return to the Activity which called it (it will come into onActivityResult). This way you can achieve:
Activty 1 -&gt; Activity 2 -&gt; Activity 1 -&gt; Activity 3 -&gt; Activity 1 etc
Activty 1 -&gt; Activity 2 -&gt; Activity 3 -&gt; Activity 2 -&gt; Activty 1 etc
In both cases, you don't can keep "passing through" phases of an activity invisible, they can just receive the "activity you called" trigger and pass on to the next activity.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:03/19/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<android><android-layout><android-intent>', 'Title': 'Starting Activities in Android', 'ViewCount': 74, 'id': 15510836, 'user_AboutMe': '', 'user_AccountId': 1297326.0, 'user_DisplayName': 'MDMalik', 'user_Reputation': 3935.0, 'user_Views': 483.0, 'user_id': 1248044.0}}