java - Using intent between activities, in reverse - Android -
i quite new android programming (aswell java in general) , have run issue has me stumped. building basic app (for practice) accesses built website www.shodan.io . far know there no android app particular site yet , quite enjoy research. have app has 4 activities, of load beautifully (after stack forums). are: loadingpage, mainactivity, searchpage, , exploitsearch. on mainactivity, have webview display different pages, buttons switch between, logos, etc. search , exploit buttons each load respective pages without issue. question/problem.
i have search , exploit activities take input (which purpose), save said input string, accessible mainactivty , used search query url.
my search far has turned many forums telling how take data activity1 , have readable activity2 using "intent". however, cant seem find resources doing reverse, or saving string (maybe in temp file, , preferably can recalled later... kinda "input"+\n not overwritten)
thank time (ps. let me know portions of code needed dont want fill thread 4 activities , respective layout files.)
source: getting result activity
from activity1:
public static final string result_request = 1;
when want start activity2:
intent intent = new intent(this, activity2.class); startactivityforresult(intent, result_request);
this called when activity2 finished:
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { // check request we're responding if (requestcode == result_request) { // make sure request successful if (resultcode == result_ok) { string result = data.getstringextra("result"); } } }
and activity2, when done , want send string back:
intent returnintent = new intent(); returnintent.putextra("result","some string"); setresult(result_ok,returnintent); finish();
we have used result_request uniquely identify our own request, , need check if requestcode same 1 have started second activity.
Comments
Post a Comment