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. Contoh android user interface

http://www.readwriteweb.com/archives/future_android_interfaces_videos.php?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+readwriteweb+(ReadWriteWeb)

<http://www.readwriteweb.com/archives/future_android_interfaces_videos.php?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+readwriteweb+(ReadWriteWeb)>cek
link di atas untuk melihat contoh user interface untuk android, ada beberapa
video demo yang bisa di tonton.

Salam

Suhendro

-- 
===============
"Indonesian Android Community [id-android]"

PING'S mobile
Email: sa...@pings-mobile.com  Ph. (021) 96087100
---------------------
Yopie Ratjoen
Email: yo...@ratjoen.com  Ph. 08977726681
--------------------
Gila original
Email: i...@gilaoriginal.com  Ph. (031) 91555898
--------------------

Aturan Jual/Kloteran ID-Android  http://goo.gl/azW7

2. Problems with uploading files to webservice

Hello,

I have a rest webservice that takes a POST metod with multipart
message:

@Path("transferFile")
 @POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_XML)
public String multipartTest(com.sun.jersey.multipart.MultiPart data)
{
try {
// get first body part (index 0)
BodyPart bp = multiPart.getBodyParts().get(0);
etc..

Now I tried to write a client on android to send a file to this
server. So I used the normal way to send multipart message on android:

    HttpClient client = new DefaultHttpClient();
 client.getParams().setParameter("http.socket.timeout", new
Integer(90000)); // 90 second

HttpPost httpPost = new HttpPost("http://127.0.0.1:8080/webapp/
transferFile");
 httpPost.setHeader("Content-Type", MediaType.MULTIPART_FORM_DATA );

//tried with and without base64
 byte [] encodedWavestream = Base64.encodeBytesToBytes(wavestream);
 InputStream ins = new ByteArrayInputStream(encodedWavestream);
 InputStreamBody body = new InputStreamBody(ins, "test" );
 int send = ins.available();

MultipartEntity requestContent = new
MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE );
requestContent.addPart("stream", body);

httpPost.setEntity(requestContent);
HttpResponse Response = client.execute(httpPost);

An this gives an annoying response from the server :

HTTP Status 400 - Bad Request
The request sent by the client was syntactically incorrect (Bad
Request).

I check the server log files but there is nothing there. So I don't
know what's the origin of this error. I have wrote a simple html page
with a post formula and 'multipart/form-data' content-type and it
works. I created a Jersey client on a PC and it also works. However I
have big problems with implementing this Jersey api on android. Why my
android client does not work? Can anybody help please?

-- 

3. how to merge column of a table

4. Q: How to do an expand animation?

5. android edittext

6. Slow execution getThumbnail in HTC hero

7. Accessing style items by style ID