android - How does putExtra() works? -


can tell me how putextra() works? how , stores data passed ? still confused how data inside works , how passed 1 activity other activity? how structure organised? or values stored on inside of intent class ?

imagine there class a. has 1 static string example.i want fill string in next activity call activityforresult()

now there class b.i filled textbox id text_entered. , put code

intent text = new intent(); test.putextra(a.example, text_entered); 

now text saved, in example or in intent test?

activity1.class

intent intent = new intent(getapplicationcontext(), activity2.class);     intent.putextra("extra_name", 4);//int     intent.putextra("extra_name", "string_values");//string 

activity2.class

string stringvalue = getintent().getstringextra("extra_name");//string     int ivalue = getintent().getintextra("extra_name", 0);//defaultvalue = 0 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -