Example usage for android.app Fragment onActivityResult

List of usage examples for android.app Fragment onActivityResult

Introduction

In this page you can find the example usage for android.app Fragment onActivityResult.

Prototype

public void onActivityResult(int requestCode, int resultCode, Intent data) 

Source Link

Document

Receive the result from a previous call to #startActivityForResult(Intent,int) .

Usage

From source file:com.example.leonid.twitterreader.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Pass the activity result to the fragment, which will
    // then pass the result to the login button.
    Fragment fragment = getFragmentManager().findFragmentByTag("twitter");
    if (fragment != null) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }/*from ww  w . j ava  2 s. c o  m*/
}

From source file:self.yue.vehicletracker.ui.main.MainFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Fragment fragment = getFragmentManager()
            .findFragmentByTag("android:switcher:" + R.id.view_pager + ":" + mPager.getCurrentItem());
    fragment.onActivityResult(requestCode, resultCode, data);
}

From source file:my.madet.uniteninfo.MainHome.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d("onActivityResult", "onActivityResult in main Home " + requestCode);
    Log.d("onActivityResult", "onActivityResult in main Home " + data.getIntExtra("RESPONSE_CODE", 0));
    super.onActivityResult(requestCode, resultCode, data);

    FragmentManager fragmentManager = getFragmentManager();
    Fragment fragment = fragmentManager.findFragmentById(R.id.frame_container);
    if (fragment != null) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }// w  ww  .  java2s  .c  o  m
}

From source file:com.google.android.apps.forscience.whistlepunk.MainActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO: Do this for all possible IDs in case others have activity results.
    Fragment fragment = getFragmentManager().findFragmentByTag(String.valueOf(R.id.navigation_item_observe));
    if (fragment != null) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }//from w  w  w  .  j ava2 s.  c o  m
}

From source file:com.chuhan.privatecalc.fragment.os.FragmentActivity.java

/**
 * Dispatch incoming result to the correct fragment.
 *//* w  w  w  .j  ava 2s  .c  om*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    mFragments.noteStateNotSaved();
    int index = requestCode >> 16;
    if (index != 0) {
        index--;
        if (mFragments.mActive == null || index < 0 || index >= mFragments.mActive.size()) {
            Log.w(TAG, "Activity result fragment index out of range: 0x" + Integer.toHexString(requestCode));
            return;
        }
        Fragment frag = mFragments.mActive.get(index);
        if (frag == null) {
            Log.w(TAG, "Activity result no fragment exists for index: 0x" + Integer.toHexString(requestCode));
        } else {
            frag.onActivityResult(requestCode & 0xffff, resultCode, data);
        }
        return;
    }

    super.onActivityResult(requestCode, resultCode, data);
}

From source file:com.luke.lukef.lukeapp.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    for (android.support.v4.app.Fragment fragment : getSupportFragmentManager().getFragments()) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }/*w  ww.j  av  a 2s .  c  o  m*/
}

From source file:com.google.android.apps.forscience.whistlepunk.project.experiment.ExperimentDetailsFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == PictureUtils.REQUEST_TAKE_PHOTO) {
        Fragment dialog = getChildFragmentManager().findFragmentByTag(AddNoteDialog.TAG);
        if (dialog != null) {
            dialog.onActivityResult(requestCode, resultCode, data);
        }//ww  w.j a va 2  s.  co m
    }
}

From source file:android.app.Activity.java

void dispatchActivityResult(String who, int requestCode, int resultCode, Intent data) {
    if (false)//from  w w  w .j  av  a2  s .co  m
        Log.v(TAG, "Dispatching result: who=" + who + ", reqCode=" + requestCode + ", resCode=" + resultCode
                + ", data=" + data);
    Log.w("MIGRATOR", "Dispatching result: who=" + who + ", reqCode=" + requestCode + ", resCode=" + resultCode
            + ", data=" + data);
    mFragments.noteStateNotSaved();
    if (who == null) {
        onActivityResult(requestCode, resultCode, data);
    } else {
        Fragment frag = mFragments.findFragmentByWho(who);
        if (frag != null) {
            frag.onActivityResult(requestCode, resultCode, data);
        }
    }
}