Need help about Intent

by gganesh » Tue, 24 Feb 2009 13:38:26 GMT


Sponsored Links
 hi friends,
i have two classes Screen1 and Screen2 both extends activity
i have to pass data from the Screen1 to Screen 2

i wrote in onCreate method of Screen1 class


 t=(EditText)findViewById(R.id.ed1);
 b=(Button)findViewById(R.id.but1);
         b.setOnClickListener(new Button.OnClickListener()
         {
                public void onClick(View v)
                {
                        Intent i= new Intent(v.getContext(),Screen2.class);
                        i.putExtra("myval",t.toString());
                        startActivity(i);
                }

My doubt is ,how to receive myval data in Screen2 class ,what is the
code i have to add in AndroidManifest.xml file
--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by dillirao malipeddi » Tue, 24 Feb 2009 13:46:11 GMT


 you have to
use

Bundle your_extras = getIntent.getExtras();

String val = your_extras.getExtras("myval");








-- 
Dilli Rao. M
ARIJASOFT
+91 - 9703073540

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Need help about Intent

by gganesh » Tue, 24 Feb 2009 16:43:02 GMT


 but the code   " your_extras.getExtras(myval) ; "
didn't work ,i suppose there is no such method in Bundle class
i tried as show below
       Bundle your_extras = this.getIntent().getExtras();
        String val = (String) your_extras.get("myval");
 but the "val" doesn't gives me the required data
Any suggestions ?
Thanks





On Feb 24, 10:46am, dillirao malipeddi <dillir...@arijasoft.com>



--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by dillirao malipeddi » Tue, 24 Feb 2009 17:03:00 GMT


 in your first Activity

        Intent my_intent = new Intent(FirstScreen.this.getApplication(),
SecondScreen.class);

        my_intent.putExtra("Value_String", "HaiHow R U");

        startActivity(intent);


in your Second Activity
in onCreate

Bundle extras = getIntent().getExtras();

String fromFirstActivity= extras.getString("Value_String");

you can use fromFirstActivity as from previous activity value


imp:

 the value pasesed in putExtras()   // Value_String

use the same for get the value in second Activity









-- 
Dilli Rao. M
ARIJASOFT
+91 - 9703073540

--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by dillirao malipeddi » Tue, 24 Feb 2009 17:07:17 GMT


 n your first Activity

b.setOnClickListener(new Button.OnClickListener()


load_SecondActivity()
{

Intent my_intent = new Intent(FirstScreen.this.getApplication(),
SecondScreen.class);

my_intent.putExtra("Value_String", "HaiHow R U");

startActivity(my_intent);
}

in your Second Activity
in onCreate

Bundle extras = getIntent().getExtras();

String fromFirstActivity= extras.getString("Value_String");

you can use fromFirstActivity as from previous activity value


On Tue, Feb 24, 2009 at 2:32 PM, dillirao malipeddi <dillir...@arijasoft.com




--
Dilli Rao. M
ARIJASOFT
+91 - 9703073540

--~--~---------~--~----~------------~-------~--~----~



Need help about Intent

by gganesh » Tue, 24 Feb 2009 17:18:54 GMT


 sorry, i have made a minor mistake ,the code given by me works
perfectly
and the "val" is displayed as excepted  .






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Get text to string from website

I've got an environment set up where a call to a coldfusion page
(http://apps.company.com/appstartup.cfm) will return nothing but a
text string (no HTML, just the text string). I need my app to grab
that and build a string in the background when my app starts up. I
have no idea how to get the HTTP connection working for it. I have
looked at some samples but just ended up confused. :/

Can you guys help me?

-- 

2. gamepad events in InputEvent onKeyDown event

When I connect my USB logitech gamepad, it gets detected by android. I
found that It is listed in the /proc/bus/input/devices file. Also I
can see an entry in /dev/input/event6.

I also tried cat and evtest on /dev/input/event6 and both show key
press data on the screen.

However I am not getting any event in the onKeyDown event.

Is there a way you can  get raw gamepad/joystick event in the app
(onKeyDown or other events)

Thank,
Hardik



-- 

3. Specifying drawables for 960x540 (specifically, the Atrix)

4. Spinner with added Text

5. ANDROID IMAGE TRANSMISSION

6. hello:

7. Charging for updates in Android market - officially announced but can't find how to enable/use it?