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.
 http://developer.android.com/intl/zh-CN/reference/android/app/Activity.html 




--


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(),
ActivityClass2.class);
    newIntent.putExtras(bundle);
    startActivity(newIntent);

In ActivityClass2, we can read this parameter using

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





--



Other Threads

1. Booting Android from NAND

Hello,
I'm trying to boot Android from NAND.
I was able to write the kernel to NAND but I don't know how to write
the Android file system to NAND!
I tried to put it in a SD card and then fatload it but it doesn't seem
to work!
Can anyone please help?
Thanks

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. selecting item from a list

I'm trying to use a ListView with Buttons beneath the listview, and am
running into problems where the listview and buttons just don't
realize each other are there (they overlap)

Currently the xml file is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content">

        <Button
                android:id="@+id/addTask"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Add Task" />

    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:drawSelectorOnTop="false"/>

</RelativeLayout>

and the java code is:

public class TaskManager extends ListActivity {
        protected static final int SUB_ACTIVITY_REQUEST_CODE = 1337;
        private String array_spinner[];
        final int SUCCESS_RETURN_CODE = 1;
        List<String> tasks;
        int currentposition;

        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.taskmanager);

                ArrayList <String> arrayList = new ArrayList<String>();
                arrayList.add("Task1");
                arrayList.add("Task2");
                arrayList.add("Task3");

                tasks = arrayList;
                Button addButton = (Button)findViewById(R.id.addTask);

                addButton.setOnClickListener(new View.OnClickListener() {

...
...

I'm also not sure if using a ListView in this case is the correct
solution.  What I'm trying to do is have a list of options that the
user can select, and when they select it, it remains highlighted, then
I can use that value when I press another button, for example:

item 1
item 2
item 3

[Move item up]
[Move item down]

where [ ]'s are buttons

Any suggestions with what I should actually be using?  I tried looking
up "android selection list" but the closest thing was selection
dialog, which isn't what I'm looking for.

Thanks,
Moiraine

-- 

3. glTexImage2D very slow on phones like Nexus one

4. Strange black blank between keyboard and customized EditTextView

5. how to build the gallery application.

6. How does NotificationService work?

7. How to set and get thread priority from Java and native layers