android - onActivityResult in Activity not called after startActivityForResult from Fragment in API 18 -
i want user select picture gallery, therefore have following.
i have settingsactivity says:
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == result_load_image && resultcode == result_ok && null != data) { //do sth here } }
in oncreatemethod of settingsactivity do:
getfragmentmanager().begintransaction().replace(android.r.id.content, new settingsfragment()).commit();
and have settingsfragment following in oncreate()
preference pref = (preference) findpreference(settingsconstants.key.pref_background_image); pref.setonpreferenceclicklistener(new preference.onpreferenceclicklistener() { @override public boolean onpreferenceclick(preference preference) { intent intent = new intent(); intent.settype("image/*"); intent.putextra(intent.extra_local_only, true); intent.putextra(intent.category_openable, true); intent.setaction(intent.action_get_content); getactivity().startactivityforresult(intent.createchooser(intent, "select picture"), settingsactivity.result_load_image); return true; } });
this worked in 4.2 - not working 4.3 anymore! can tell me i'm missing here, or facing same issue?
it called, request code u set in fragment different in parameter of onactivityresult
activity's method!
Comments
Post a Comment