Another Android Blog

Insights into those hard to solve Android Development problems

Skip to: Content | Sidebar | Footer

Category: Snippets

Passing Data With an Intent

27 May, 2011 (01:47) | Snippets | By: Randall Mitchell

This is the code to pass data from one activity to another through an Intent. This is the code used to create and pass data into an Intent. String dataToPass = "The next activity needs this sentence."; … Intent intent = new Intent(this, NextActivity.class); intent.putExtras("KeyToAccessData", dataToPass); startActivity(intent); And this is how you catch that data [...]

Launch New Activity

25 May, 2011 (00:04) | Snippets | By: Randall Mitchell

Intent takes two parameters in the most basic example. The first parameter is the class calling the new Activity (Intent). The second parameter is the class name of the Activity to launch. Intent intent = new Intent(this, ActivityClassToLaunch.class); startActivity(intent); Using finish() will close the calling activity. This will keep the user from using the back [...]