java android, onActivityResult not working -


i need implement app other android project , facing problem method onactivityresult doesn't work. want achieve intent return result class 1 (g_map) can't figure out how works.

i have class 1:

public class g_map extends graphobj{      private context contextown;     private activity act;      public g_map(graphobjmgr gom, final context context, graphsetting gs) {         super(gom, context, gs, r.layout.test_map);         intent = new intent(contextown, picklocationactivity.class);         act.startactivityforresult(i, 1);      //@override     public void onactivityresult(final int requestcode, int resultcode, intent data) {     //super.onactivityresult(requestcode, resultcode, data);     log.e("state", "this won't start.");    } } 

the activity picklocationactivity starts , second class need obtain result first class. method onactivityresult can't @override , if comment method never used. can it? in app, works , don't need use act.startactivityforresult startactivityforresult.

i guess need somehow connect "act" onactivityresult method don't know how. suggestion helpful!

the class 2:

public class picklocationactivity extends appcompatactivity{      ...             intent intent = new intent();             intent.putextra("location address", predictions.getplaces().get(position).getplacedesc());             intent.putextra("placeid", predictions.getplaces().get(position).getplaceid());             setresult(custom_autocomplete_request_code, intent);             finish(); } 

the method onactivityresult can't @override , if comment method never used. can it?

override onactivityresult() in activity or fragment called startactivityforresult().

btw, code in first snippet crash nullpointerexception, not assign value act, let alone before call startactivityforresult() on it.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -