Java Code Examples for androidx.fragment.app.Fragment#onActivityResult()

The following examples show how to use androidx.fragment.app.Fragment#onActivityResult() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From science-journal with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  switch (requestCode) {
    case ActivityRequestCodes.REQUEST_GET_STARTED_ACTIVITY:
    case ActivityRequestCodes.REQUEST_SIGN_IN_ACTIVITY:
      if (resultCode == RESULT_CANCELED) {
        finish();
      }
      return;
    case ActivityRequestCodes.REQUEST_GOOGLE_SIGN_IN:
      accountsProvider.onLoginAccountsChanged(data);
      return;
    default:
      break;
  }

  // TODO: Do this for all possible IDs in case others have activity results.
  Fragment fragment =
      getSupportFragmentManager()
          .findFragmentByTag(String.valueOf(R.id.navigation_item_experiments));
  if (fragment != null) {
    fragment.onActivityResult(requestCode, resultCode, data);
  }
}
 
Example 2
Source File: ApplicationPreferencesActivity.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
  super.onActivityResult(requestCode, resultCode, data);
  Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content);
  fragment.onActivityResult(requestCode, resultCode, data);
}
 
Example 3
Source File: GrblActivity.java    From grblcontroller with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    Fragment fragment = getSupportFragmentManager().findFragmentByTag("android:switcher:" + R.id.tab_layout_pager + ":" + 1);
    if(fragment != null) fragment.onActivityResult(requestCode, resultCode, data);
}
 
Example 4
Source File: DonationsActivity.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);

	FragmentManager fragmentManager = getSupportFragmentManager();
	Fragment fragment = fragmentManager.findFragmentByTag("donationsFragment");
	if (fragment != null) {
		fragment.onActivityResult(requestCode, resultCode, data);
	}
}
 
Example 5
Source File: BasisActivity.java    From FastLib with Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    List<Fragment> list = getSupportFragmentManager().getFragments();
    if (list == null || list.size() == 0) {
        return;
    }
    for (Fragment f : list) {
        f.onActivityResult(requestCode, resultCode, data);
    }
}
 
Example 6
Source File: MimiActivity.java    From mimi-reader with Apache License 2.0 5 votes vote down vote up
public void setResultFragment(final Fragment resultFragment, final boolean dispatchResults) {
    this.resultFragment = resultFragment;

    if (dispatchResults && savedIntentData != null) {
        resultFragment.onActivityResult(savedRequestCode, savedResultCode, savedIntentData);
    }
}
 
Example 7
Source File: UpdateExperimentActivity.java    From science-journal with Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
  if (fragment != null && requestCode == PictureUtils.REQUEST_TAKE_PHOTO) {
    fragment.onActivityResult(requestCode, resultCode, data);
  } else {
    super.onActivityResult(requestCode, resultCode, data);
  }
}
 
Example 8
Source File: ClaimExperimentsActivity.java    From science-journal with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
  if (fragment != null) {
    fragment.onActivityResult(requestCode, resultCode, data);
  }
}
 
Example 9
Source File: ActivityResultNavigator.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  resultRelay.call(new Result(requestCode, resultCode, data));

  Fragment fragment = getFragmentNavigator().getFragment();
  if (fragment != null
      && fragment instanceof FragmentView
      && !((FragmentView) fragment).isStartActivityForResultCalled()) {
    fragment.onActivityResult(requestCode, resultCode, data);
  }
}
 
Example 10
Source File: ApplicationPreferencesActivity.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
  super.onActivityResult(requestCode, resultCode, data);
  Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content);
  fragment.onActivityResult(requestCode, resultCode, data);
}
 
Example 11
Source File: DonationActivity.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
/**
 * Needed for Google Play In-app Billing. It uses startIntentSenderForResult(). The result is not propagated to
 * the Fragment like in startActivityForResult(). Thus we need to propagate manually to our Fragment.
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    FragmentManager fragmentManager = getSupportFragmentManager();
    Fragment fragment = fragmentManager.findFragmentByTag("donationFragment");
    if (fragment != null) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }
}
 
Example 12
Source File: ContributeActivity.java    From DistroHopper with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onActivityResult (int requestCode, int resultCode, Intent data)
{
	super.onActivityResult (requestCode, resultCode, data);
	
	FragmentManager fragmentManager = this.getSupportFragmentManager();
	Fragment fragment = fragmentManager.findFragmentByTag ("donationsFragment");
	if (fragment != null)
		fragment.onActivityResult (requestCode, resultCode, data);
}
 
Example 13
Source File: RecipientPreferenceActivity.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.preference_fragment);
  fragment.onActivityResult(requestCode, resultCode, data);
}