java - Sending variable between activities -


this question has answer here:

this question simple. there example 2 activities main activity , main activity 2. how can send string(for example) main activity main activity 2. let's if main activity 2 gets string. calls function change string. , how send changed string main activity?

from main activity 1 send string:

                intent intent = new intent(this, mainactivity2);                 intent.putextra("string", stringval);                 intent.addflags(intent.flag_activity_new_task);                 startactivity(intent); 

then in main activity 2, receive string:

string str = getintent().getextras().getstring("string"); 

then change value , send main activity 1, intent within onresume if want, check nulls.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -