really easy question... but not for me =P

by Kofa » Wed, 03 Mar 2010 06:21:55 GMT

Sponsored Links
 I'm trying to read a variable from one activity to another... i
explain better: I'm making a video game, so the user will have to
chose like a team, color, and other options from one activity and then
should read this variables from another activity.
so the question is... how can i declare integer, string, etc values
from one activity and then read it from another activity? thx a lot


really easy question... but not for me =P

by Ozymandias » Wed, 03 Mar 2010 06:33:44 GMT

 So are you talking about like a Setup activity, where you choose those
things, and then when you're done it launches the game?

If that's what you're talking about, you would create the second
activity and pass the config options to it at creation. 


Sponsored Links

really easy question... but not for me =P

by Vladimir » Wed, 03 Mar 2010 17:31:59 GMT

 Use intent.putExtra(key, value) in your 1st activity and access them
using getIntent().getExtras() in the 2nd


really easy question... but not for me =P

by SREEHARI » Wed, 03 Mar 2010 18:05:13 GMT

 U can use bundle also in passing that variable values.....
In 1st activity
    Bundle bundle = new Bundle();
    bundle.putString(aram1 est;

    Intent newIntent = new Intent(this.getApplicationContext(),

In ActivityClass2, we can read this parameter using

    Bundle bundle = this.getIntent().getExtras();
    String param1 = bundle.getString(aram1;


Other Threads

1. Platform Library Example - The Details I Don't Get


I've spent a couple days now googling this and trying to figure out
all the steps, and I'm getting really frustrated. I'm using the
Platform Library example and trying to figure out how to add my own
library to android. It resides in my own namespace, and is intended
for a full image build so that it's already on a device ready for
other applications to use.

I have a Unix system that I can compile the android source code on,
and have my library already designed. What I can't figure out is the
following -

1. Where do I put my library in the file system so that it will get
compiled? Do I put it under framework and create a new folder there or
somewhere else? The README.txt mentions a file to be put in /system/
etc/permissions to declare things to the framework - however nowhere
under mydroid (top level folder), can I find anything that looks like
it goes to /system/etc/ on the device. I know it's got to be there

2. What base build system files do I have to change so that this jar
will compile and be included correctly? The top level file
for the whole system? I'm confused on this point.

3. When an application uses my library, is there anyway to tell
Eclipse about this? I know the is how you specify
LOCAL_JAVA_LIBRARIES, but there is no for eclipse projects.
Does using a custom library preclude the ability to use eclipse?

Any help at all would be very appreciated.



2. Trying to connect Nexus One phone to the adb


I am running Android SDK 2.2 and am trying to get the adb to connect
to the Google Nexus One phone.
Here is what I have done so far:

- Followed the instructions on setting up the device for development
as given on the Android Developer's site:

- added android:debuggable="true" to my application manifest

- USB debuggable is checked on the phone

- downloaded the Device Drivers For Windows Revision 3 (this supports
Nexus One phones)

- Went through the Hardware Installation wizard to install the device
- the device shows up as "Android Composite ADB Interface".

When I run adb devices on the shell, the device appears for a moment,
then disappears.
On the Eclipse console, I get the following messages:
[2010-11-13 11:54:42 - DeviceMonitor]Failed to start monitoring
<device id>

Has anyone run into a similar problem? Any help on this would be
great. I can't test my application on the device if the adb cannot
view the device. Thanks so much in advance.



3. scuss developing Android applications using the Android SDK

4. Drawing does not appear in custom SurfaceView

5. trying to place text inside ShapeDrawables

6. computer knowledge

7. Detecting flings in a ListActivity containing non-simple views