I have a preferences screen that provides the user with a checkbox to disable ads. When a user clicks on this for the first time, they are given the option to purchase in-app purchases to disable ads.
The problem I am facing is that I see no way to get the onActivityResult callback to the fragment.
So, I have a PreferenceActivity, loading a PreferenceFragment (from which I cannot get the link). In the application, Billing requires a call to startIntentSenderForResult
, in which there are no fragments, only actions.
When I start the shopping stream using startIntentSenderForResult
, the Activity onActivityResult
, but I need this in the fragment.
Since I loaded the PreferenceFragment into the PreferenceActivity with the following, I donβt think I can get a fragment reference to pass the call.
@Override public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.layout.preferences_headers, target); } @Override public Intent getIntent() { final Intent modIntent = new Intent(super.getIntent()); modIntent.putExtra(EXTRA_SHOW_FRAGMENT, SyncPreferencesFragment.class.getName()); modIntent.putExtra(EXTRA_NO_HEADERS, true); return modIntent; }
What am I missing here? I do not want to share the whole logic of the purchase, so how can I get my fragment for calling onActivityForResult
?
source share