android - onActivityResult() not called in fragment and activity finishes -
i have fragment within activity , using button select notification sound using ringtone picker:
selectsound.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { intent intent = new intent(ringtonemanager.action_ringtone_picker); intent.putextra(ringtonemanager.extra_ringtone_type, ringtonemanager.type_notification); intent.putextra(ringtonemanager.extra_ringtone_title, "select tone"); if (notification != null) { intent.putextra(ringtonemanager.extra_ringtone_existing_uri, (uri) notification); } log.v("tasks", "starting ringtone picker reminders"); startactivityforresult(intent, 5001); } });
here's onactivityresult in fragment:
@override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); log.v("tasks", "onactivityresult in remindersettings: " + requestcode); if (resultcode == activity.result_ok && requestcode == 5001) { uri uri = data.getparcelableextra(ringtonemanager.extra_ringtone_picked_uri); sharedpreferences settings = mactivity.getsharedpreferences("settings", context.mode_private); editor editor = settings.edit(); if (uri != null) { editor.putstring("notification_sound", uri.tostring()); } else { editor.putstring("notification_sound", null); } editor.commit(); } }
my activity has onactivityresult make call unhandled results:
@override protected void onactivityresult( int requestcode, int resultcode, intent data) { ... super.onactivityresult(requestcode, resultcode, data); }
the strange thing after launching , selecting ringtone neither onactivityresult in fragment or activity called when debug , activity seems finish - there no force close or exception on logcat. have tested on 2 different devices , same result - i'm using actionbarsherlock fragments if thats relevant.
Comments
Post a Comment