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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -