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

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -