Click here to Skip to main content
13,005,798 members (77,580 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 4 Feb 2013

Passing Values to an Intent

, 4 Feb 2013
Rate this:
Please Sign up or sign in to vote.
Tip on how to pass a value to an intent


It's the simplest thing. An Android developer will need some time passing a value from one intent to another, making intents aware of each other.

Using the Code

Intent myIntent = new Intent(this, mySecondActivity.class);
myIntent.putExtra("KeyName", keyValue);

Points of Interest

You can pass whatever value you want to the other activity. Using the below code, you can retrieve the values given from the previous activity. 

Bundle extras = getIntent().getExtras();
if (extras != null) {
String value = extras.getString("KeyName");


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Greece Greece
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170627.1 | Last Updated 4 Feb 2013
Article Copyright 2013 by DASoftware
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid