Example usage for android.app Activity RESULT_OK

List of usage examples for android.app Activity RESULT_OK

Introduction

In this page you can find the example usage for android.app Activity RESULT_OK.

Prototype

int RESULT_OK

To view the source code for android.app Activity RESULT_OK.

Click Source Link

Document

Standard activity result: operation succeeded.

Usage

From source file:cw.kop.autobackground.sources.SourceInfoFragment.java

@Override
public void onActivityResult(int requestCode, int responseCode, Intent intent) {

    if (requestCode == GoogleAccount.GOOGLE_ACCOUNT_SIGN_IN) {
        if (intent != null && responseCode == Activity.RESULT_OK) {
            final String accountName = intent.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
            AppSettings.setGoogleAccountName(accountName);
            new AsyncTask<Void, Void, Void>() {
                @Override//ww w. j a va 2  s.  c  om
                protected Void doInBackground(Void... params) {
                    try {
                        String authToken = GoogleAuthUtil.getToken(appContext, accountName,
                                "oauth2:https://picasaweb.google.com/data/");
                        AppSettings.setGoogleAccountToken(authToken);
                        AppSettings.setGoogleAccount(true);
                        new PicasaAlbumTask(-1, true).execute();
                    } catch (IOException transientEx) {
                        return null;
                    } catch (UserRecoverableAuthException e) {
                        e.printStackTrace();
                        startActivityForResult(e.getIntent(), GoogleAccount.GOOGLE_AUTH_CODE);
                        return null;
                    } catch (GoogleAuthException authEx) {
                        return null;
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                    return null;
                }
            }.execute();
        }
    }
    if (requestCode == GoogleAccount.GOOGLE_AUTH_CODE) {
        if (responseCode == Activity.RESULT_OK) {
            new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... params) {
                    try {
                        String authToken = GoogleAuthUtil.getToken(appContext,
                                AppSettings.getGoogleAccountName(),
                                "oauth2:https://picasaweb.google.com/data/");
                        AppSettings.setGoogleAccountToken(authToken);
                        AppSettings.setGoogleAccount(true);
                        new PicasaAlbumTask(-1, true).execute();
                    } catch (IOException transientEx) {
                        return null;
                    } catch (UserRecoverableAuthException e) {
                        return null;
                    } catch (GoogleAuthException authEx) {
                        return null;
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                    return null;
                }
            }.execute();
        }
    }
}

From source file:com.abplus.surroundcalc.billing.BillingHelper.java

/**
 * Handles an activity result that's part of the purchase flow in in-app billing. If you
 * are calling {@link #launchPurchaseFlow}, then you must call this method from your
 * Activity's {@link android.app.Activity@onActivityResult} method. This method
 * MUST be called from the UI thread of the Activity.
 *
 * @param requestCode The requestCode as you received it.
 * @param resultCode The resultCode as you received it.
 * @param data The data (Intent) as you received it.
 * @return Returns true if the result was related to a purchase flow and was handled;
 *     false if the result was not related to a purchase, in which case you should
 *     handle it normally.//  w w  w.j a  v a  2  s. com
 */
public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {
    Result result;
    if (requestCode != this.requestCode)
        return false;

    checkSetupDone("handleActivityResult");

    asyncFlag.end();

    if (data == null) {
        result = new Result(HELPER_BAD_RESPONSE, "Null data in IAB result");
        if (purchaseListener != null) {
            purchaseListener.onPurchaseFinished(result, null);
        }
        return true;
    }

    int responseCode = getResponseCodeFromIntent(data);
    String purchaseData = data.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA);
    String dataSignature = data.getStringExtra(RESPONSE_INAPP_SIGNATURE);

    if (resultCode == Activity.RESULT_OK && responseCode == BILLING_RESPONSE_RESULT_OK) {

        if (purchaseData == null || dataSignature == null) {
            result = new Result(HELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature");
            if (purchaseListener != null) {
                purchaseListener.onPurchaseFinished(result, null);
            }
            return true;
        }

        Purchase purchase;
        try {
            purchase = new Purchase(purchaseData, dataSignature);
            String sku = purchase.getSku();

            if (!security.verifyPurchase(purchaseData, dataSignature)) {
                result = new Result(HELPER_VERIFICATION_FAILED, "Signature verification failed for sku " + sku);
                if (purchaseListener != null) {
                    purchaseListener.onPurchaseFinished(result, purchase);
                }
                return true;
            }
        } catch (JSONException e) {
            e.printStackTrace();
            result = new Result(HELPER_BAD_RESPONSE, "Failed to parse purchase data.");
            if (purchaseListener != null) {
                purchaseListener.onPurchaseFinished(result, null);
            }
            return true;
        }

        if (purchaseListener != null) {
            purchaseListener.onPurchaseFinished(new Result(BILLING_RESPONSE_RESULT_OK, "Success"), purchase);
        }
    } else if (resultCode == Activity.RESULT_OK) {
        if (purchaseListener != null) {
            result = new Result(responseCode, "Problem purchashing item.");
            purchaseListener.onPurchaseFinished(result, null);
        }
    } else if (resultCode == Activity.RESULT_CANCELED) {
        result = new Result(HELPER_USER_CANCELLED, "User canceled.");
        if (purchaseListener != null) {
            purchaseListener.onPurchaseFinished(result, null);
        }
    } else {
        result = new Result(HELPER_UNKNOWN_PURCHASE_RESPONSE, "Unknown purchase response.");
        if (purchaseListener != null)
            purchaseListener.onPurchaseFinished(result, null);
    }
    return true;
}

From source file:com.example.transfer.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    // Choose what to do based on the request code
    switch (requestCode) {

    // If the request code matches the code sent in onConnectionFailed
    case LocationUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST:

        switch (resultCode) {
        // If Google Play services resolved the problem
        case Activity.RESULT_OK:

            // Log the result
            Log.d(LocationUtils.APPTAG, getString(R.string.resolved));

            // Display the result
            mConnectionState.setText(R.string.connected);
            mConnectionStatus.setText(R.string.resolved);
            break;

        // If any other result was returned by Google Play services
        default:/*from   w  w  w.j  a  v  a  2 s.c o  m*/
            // Log the result
            Log.d(LocationUtils.APPTAG, getString(R.string.no_resolution));

            // Display the result
            mConnectionState.setText(R.string.disconnected);
            mConnectionStatus.setText(R.string.no_resolution);

            break;
        }

        // If any other request code was received
    default:
        // Report that this Activity received an unknown requestCode
        Log.d(LocationUtils.APPTAG, getString(R.string.unknown_activity_request_code, requestCode));

        break;
    }
}

From source file:com.openerp.addons.messages.MessageDetail.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
    case MESSAGE_REPLY:
        if (resultCode == Activity.RESULT_OK) {
            Bundle bundle = new Bundle();
            bundle.putInt("message_id", message_id);
            LoadMessageDetails messageDetails = new LoadMessageDetails(message_id);
            messageDetails.execute((Void) null);
        }//  w  w w.  j  av a  2 s. com
        break;
    }
}

From source file:net.bluecarrot.lite.MainActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    //used to upload files
    // code for all versions except of Lollipop
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {

        if (requestCode == FILECHOOSER_RESULTCODE) {
            if (null == this.mUploadMessage)
                return;

            Uri result = null;/*from w w  w  . j  ava 2  s  .co m*/

            try {
                if (resultCode != RESULT_OK)
                    result = null;
                else {
                    // retrieve from the private variable if the intent is null
                    result = data == null ? mCapturedImageURI : data.getData();
                }
            } catch (Exception e) {
                Toast.makeText(getApplicationContext(), "activity :" + e, Toast.LENGTH_LONG).show();
            }

            mUploadMessage.onReceiveValue(result);
            mUploadMessage = null;
        }

    } // end of code for all versions except of Lollipop

    // start of code for Lollipop only
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        if (requestCode != FILECHOOSER_RESULTCODE || mFilePathCallback == null) {
            super.onActivityResult(requestCode, resultCode, data);
            return;
        }

        Uri[] results = null;

        // check that the response is a good one
        if (resultCode == Activity.RESULT_OK) {
            if (data == null || data.getData() == null) {
                // if there is not data, then we may have taken a photo
                if (mCameraPhotoPath != null) {
                    results = new Uri[] { Uri.parse(mCameraPhotoPath) };
                }
            } else {
                String dataString = data.getDataString();
                if (dataString != null) {
                    results = new Uri[] { Uri.parse(dataString) };
                }
            }
        }

        mFilePathCallback.onReceiveValue(results);
        mFilePathCallback = null;

    } // end of code for Lollipop only
}

From source file:com.kyleshaver.minuteofangle.util.IabHelper.java

/**
     * Handles an activity result that's part of the purchase flow in in-app billing. If you
     * are calling {@link #launchPurchaseFlow}, then you must call this method from your
     * Activity's {@link android.app.Activity@onActivityResult} method. This method
     * MUST be called from the UI thread of the Activity.
     */*from  w  w  w . j a v  a2s. co  m*/
     * @param requestCode The requestCode as you received it.
     * @param resultCode The resultCode as you received it.
     * @param data The data (Intent) as you received it.
     * @return Returns true if the result was related to a purchase flow and was handled;
     *     false if the result was not related to a purchase, in which case you should
     *     handle it normally.
     */
    public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {
        IabResult result;
        if (requestCode != mRequestCode)
            return false;

        checkNotDisposed();
        checkSetupDone("handleActivityResult");

        // end of async purchase operation that started on launchPurchaseFlow
        flagEndAsync();

        if (data == null) {
            logError("Null data in IAB activity result.");
            result = new IabResult(IABHELPER_BAD_RESPONSE, "Null data in IAB result");
            if (mPurchaseListener != null)
                mPurchaseListener.onIabPurchaseFinished(result, null);
            return true;
        }

        int responseCode = getResponseCodeFromIntent(data);
        String purchaseData = data.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA);
        String dataSignature = data.getStringExtra(RESPONSE_INAPP_SIGNATURE);

        if (resultCode == Activity.RESULT_OK && responseCode == BILLING_RESPONSE_RESULT_OK) {
            logDebug("Successful resultcode from purchase activity.");
            logDebug("Purchase data: " + purchaseData);
            logDebug("Data signature: " + dataSignature);
            logDebug("Extras: " + data.getExtras());
            logDebug("Expected item type: " + mPurchasingItemType);

            if (purchaseData == null || dataSignature == null) {
                logError("BUG: either purchaseData or dataSignature is null.");
                logDebug("Extras: " + data.getExtras().toString());
                result = new IabResult(IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature");
                if (mPurchaseListener != null)
                    mPurchaseListener.onIabPurchaseFinished(result, null);
                return true;
            }

            Purchase purchase = null;
            try {
                purchase = new Purchase(mPurchasingItemType, purchaseData, dataSignature);
                String sku = purchase.getSku();

                // Verify signature
                if (!Security.verifyPurchase(mSignatureBase64, purchaseData, dataSignature)) {
                    logError("Purchase signature verification FAILED for sku " + sku);
                    result = new IabResult(IABHELPER_VERIFICATION_FAILED,
                            "Signature verification failed for sku " + sku);
                    if (mPurchaseListener != null)
                        mPurchaseListener.onIabPurchaseFinished(result, purchase);
                    return true;
                }
                logDebug("Purchase signature successfully verified.");
            } catch (JSONException e) {
                logError("Failed to parse purchase data.");
                e.printStackTrace();
                result = new IabResult(IABHELPER_BAD_RESPONSE, "Failed to parse purchase data.");
                if (mPurchaseListener != null)
                    mPurchaseListener.onIabPurchaseFinished(result, null);
                return true;
            }

            if (mPurchaseListener != null) {
                mPurchaseListener.onIabPurchaseFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Success"),
                        purchase);
            }
        } else if (resultCode == Activity.RESULT_OK) {
            // result code was OK, but in-app billing response was not OK.
            logDebug("Result code was OK but in-app billing response was not OK: " + getResponseDesc(responseCode));
            if (mPurchaseListener != null) {
                result = new IabResult(responseCode, "Problem purchashing item.");
                mPurchaseListener.onIabPurchaseFinished(result, null);
            }
        } else if (resultCode == Activity.RESULT_CANCELED) {
            logDebug("Purchase canceled - Response: " + getResponseDesc(responseCode));
            result = new IabResult(IABHELPER_USER_CANCELLED, "User canceled.");
            if (mPurchaseListener != null)
                mPurchaseListener.onIabPurchaseFinished(result, null);
        } else {
            logError("Purchase failed. Result code: " + Integer.toString(resultCode) + ". Response: "
                    + getResponseDesc(responseCode));
            result = new IabResult(IABHELPER_UNKNOWN_PURCHASE_RESPONSE, "Unknown purchase response.");
            if (mPurchaseListener != null)
                mPurchaseListener.onIabPurchaseFinished(result, null);
        }
        return true;
    }

From source file:com.dwdesign.tweetings.fragment.UserProfileFragment.java

@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
    if (intent == null)
        return;/* w  ww  .  j ava 2s  . c o m*/
    switch (requestCode) {
    case REQUEST_TAKE_PHOTO: {
        if (resultCode == Activity.RESULT_OK) {
            final String path = mImageUri.getPath();
            final File file = path != null ? new File(path) : null;
            if (file != null && file.exists()) {
                mService.updateProfileImage(mUser.getId(), mImageUri, true);
            }
        }
        break;
    }
    case REQUEST_BANNER_TAKE_PHOTO: {
        if (resultCode == Activity.RESULT_OK) {
            final String path = mImageUri.getPath();
            final File file = path != null ? new File(path) : null;
            if (file != null && file.exists()) {
                mService.updateBannerImage(mUser.getId(), mImageUri, true);
            }
        }
        break;
    }
    case REQUEST_PICK_IMAGE: {
        if (resultCode == Activity.RESULT_OK && intent != null) {
            final Uri uri = intent.getData();
            final String image_path = getImagePathFromUri(getActivity(), uri);
            final File file = image_path != null ? new File(image_path) : null;
            if (file != null && file.exists()) {
                mService.updateProfileImage(mUser.getId(), Uri.fromFile(file), false);
            }
        }
        break;
    }
    case REQUEST_BANNER_PICK_IMAGE: {
        if (resultCode == Activity.RESULT_OK && intent != null) {
            final Uri uri = intent.getData();
            final String image_path = getImagePathFromUri(getActivity(), uri);
            final File file = image_path != null ? new File(image_path) : null;
            if (file != null && file.exists()) {
                mService.updateBannerImage(mUser.getId(), Uri.fromFile(file), false);
            }
        }
        break;
    }
    case REQUEST_SET_COLOR: {
        if (resultCode == Activity.RESULT_OK && intent != null) {
            final int color = intent.getIntExtra(Accounts.USER_COLOR, Color.TRANSPARENT);
            setUserColor(getActivity(), mUserId, color);
            updateUserColor();
        }
        break;
    }
    }

}

From source file:com.apps.adrcotfas.goodtime.util.IabHelper.java

/**
 * Handles an activity result that's part of the purchase flow in in-app billing. If you
 * are calling {@link #launchPurchaseFlow}, then you must call this method from your
 * Activity's {@link Activity@onActivityResult} method. This method
 * MUST be called from the UI thread of the Activity.
 *
 * @param requestCode The requestCode as you received it.
 * @param resultCode The resultCode as you received it.
 * @param data The data (Intent) as you received it.
 * @return Returns true if the result was related to a purchase flow and was handled;
 *     false if the result was not related to a purchase, in which case you should
 *     handle it normally.//from w  w w  .j  av a 2 s  .  co  m
 */
public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {
    IabResult result;
    if (requestCode != mRequestCode)
        return false;

    checkNotDisposed();
    checkSetupDone("handleActivityResult");

    // end of async purchase operation that started on launchPurchaseFlow
    flagEndAsync();

    if (data == null) {
        logError("Null data in IAB activity result.");
        result = new IabResult(IABHELPER_BAD_RESPONSE, "Null data in IAB result");
        if (mPurchaseListener != null)
            mPurchaseListener.onIabPurchaseFinished(result, null);
        return true;
    }

    int responseCode = getResponseCodeFromIntent(data);
    String purchaseData = data.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA);
    String dataSignature = data.getStringExtra(RESPONSE_INAPP_SIGNATURE);

    if (resultCode == Activity.RESULT_OK && responseCode == BILLING_RESPONSE_RESULT_OK) {
        logDebug("Successful resultcode from purchase activity.");
        logDebug("Purchase data: " + purchaseData);
        logDebug("Data signature: " + dataSignature);
        logDebug("Extras: " + data.getExtras());
        logDebug("Expected item type: " + mPurchasingItemType);

        if (purchaseData == null || dataSignature == null) {
            logError("BUG: either purchaseData or dataSignature is null.");
            logDebug("Extras: " + data.getExtras().toString());
            result = new IabResult(IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature");
            if (mPurchaseListener != null)
                mPurchaseListener.onIabPurchaseFinished(result, null);
            return true;
        }

        Purchase purchase;
        try {
            purchase = new Purchase(mPurchasingItemType, purchaseData, dataSignature);
            String sku = purchase.getSku();

            // Verify signature
            if (!Security.verifyPurchase(mSignatureBase64, purchaseData, dataSignature)) {
                logError("Purchase signature verification FAILED for sku " + sku);
                result = new IabResult(IABHELPER_VERIFICATION_FAILED,
                        "Signature verification failed for sku " + sku);
                if (mPurchaseListener != null)
                    mPurchaseListener.onIabPurchaseFinished(result, purchase);
                return true;
            }
            logDebug("Purchase signature successfully verified.");
        } catch (JSONException e) {
            logError("Failed to parse purchase data.");
            e.printStackTrace();
            result = new IabResult(IABHELPER_BAD_RESPONSE, "Failed to parse purchase data.");
            if (mPurchaseListener != null)
                mPurchaseListener.onIabPurchaseFinished(result, null);
            return true;
        }

        if (mPurchaseListener != null) {
            mPurchaseListener.onIabPurchaseFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Success"),
                    purchase);
        }
    } else if (resultCode == Activity.RESULT_OK) {
        // result code was OK, but in-app billing response was not OK.
        logDebug("Result code was OK but in-app billing response was not OK: " + getResponseDesc(responseCode));
        if (mPurchaseListener != null) {
            result = new IabResult(responseCode, "Problem purchashing item.");
            mPurchaseListener.onIabPurchaseFinished(result, null);
        }
    } else if (resultCode == Activity.RESULT_CANCELED) {
        logDebug("Purchase canceled - Response: " + getResponseDesc(responseCode));
        result = new IabResult(IABHELPER_USER_CANCELLED, "User canceled.");
        if (mPurchaseListener != null)
            mPurchaseListener.onIabPurchaseFinished(result, null);
    } else {
        logError("Purchase failed. Result code: " + Integer.toString(resultCode) + ". Response: "
                + getResponseDesc(responseCode));
        result = new IabResult(IABHELPER_UNKNOWN_PURCHASE_RESPONSE, "Unknown purchase response.");
        if (mPurchaseListener != null)
            mPurchaseListener.onIabPurchaseFinished(result, null);
    }
    return true;
}

From source file:com.dreamfarmgames.util.IabHelper.java

/**
 * Handles an activity result that's part of the purchase flow in in-app billing. If you
 * are calling {@link #launchPurchaseFlow}, then you must call this method from your
 * Activity's {@link android.app.Activity@onActivityResult} method. This method
 * MUST be called from the UI thread of the Activity.
 *
 * @param requestCode The requestCode as you received it.
 * @param resultCode The resultCode as you received it.
 * @param data The data (Intent) as you received it.
 * @return Returns true if the result was related to a purchase flow and was handled;
 *     false if the result was not related to a purchase, in which case you should
 *     handle it normally./*from  w  w  w.ja  v  a2  s . com*/
 */
public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {
    IabResult result;
    if (requestCode != mRequestCode)
        return false;

    checkNotDisposed();
    checkSetupDone("handleActivityResult");

    // end of async purchase operation that started on launchPurchaseFlow
    flagEndAsync();

    if (data == null) {
        logError("Null data in IAB activity result.");
        result = new IabResult(IABHELPER_BAD_RESPONSE, "Null data in IAB result");
        if (mPurchaseListener != null)
            mPurchaseListener.onIabPurchaseFinished(result, null);
        return true;
    }

    int responseCode = getResponseCodeFromIntent(data);
    String purchaseData = data.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA);
    String dataSignature = data.getStringExtra(RESPONSE_INAPP_SIGNATURE);

    if (resultCode == Activity.RESULT_OK && responseCode == BILLING_RESPONSE_RESULT_OK) {
        logDebug("Successful resultcode from purchase activity.");
        logDebug("Purchase data: " + purchaseData);
        logDebug("Data signature: " + dataSignature);
        logDebug("Extras: " + data.getExtras());
        logDebug("Expected item type: " + mPurchasingItemType);

        if (purchaseData == null || dataSignature == null) {
            logError("BUG: either purchaseData or dataSignature is null.");
            logDebug("Extras: " + data.getExtras().toString());
            result = new IabResult(IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature");
            if (mPurchaseListener != null)
                mPurchaseListener.onIabPurchaseFinished(result, null);
            return true;
        }

        Purchase purchase = null;
        try {
            purchase = new Purchase(mPurchasingItemType, purchaseData, dataSignature);
            String sku = purchase.getSku();

            // Verify signature
            if (!Security.vPurchase(mSignatureBase64, purchaseData, dataSignature)) {
                logError("Purchase signature verification FAILED for sku " + sku);
                result = new IabResult(IABHELPER_VERIFICATION_FAILED,
                        "Signature verification failed for sku " + sku);
                if (mPurchaseListener != null)
                    mPurchaseListener.onIabPurchaseFinished(result, purchase);
                return true;
            }
            logDebug("Purchase signature successfully verified.");
        } catch (JSONException e) {
            logError("Failed to parse purchase data.");
            e.printStackTrace();
            result = new IabResult(IABHELPER_BAD_RESPONSE, "Failed to parse purchase data.");
            if (mPurchaseListener != null)
                mPurchaseListener.onIabPurchaseFinished(result, null);
            return true;
        }

        if (mPurchaseListener != null) {
            mPurchaseListener.onIabPurchaseFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Success"),
                    purchase);
        }
    } else if (resultCode == Activity.RESULT_OK) {
        // result code was OK, but in-app billing response was not OK.
        logDebug("Result code was OK but in-app billing response was not OK: " + getResponseDesc(responseCode));
        if (mPurchaseListener != null) {
            result = new IabResult(responseCode, "Problem purchashing item.");
            mPurchaseListener.onIabPurchaseFinished(result, null);
        }
    } else if (resultCode == Activity.RESULT_CANCELED) {
        logDebug("Purchase canceled - Response: " + getResponseDesc(responseCode));
        result = new IabResult(IABHELPER_USER_CANCELLED, "User canceled.");
        if (mPurchaseListener != null)
            mPurchaseListener.onIabPurchaseFinished(result, null);
    } else {
        logError("Purchase failed. Result code: " + Integer.toString(resultCode) + ". Response: "
                + getResponseDesc(responseCode));
        result = new IabResult(IABHELPER_UNKNOWN_PURCHASE_RESPONSE, "Unknown purchase response.");
        if (mPurchaseListener != null)
            mPurchaseListener.onIabPurchaseFinished(result, null);
    }
    return true;
}

From source file:com.polyvi.xface.extension.contact.XContactsExt.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (PICK_CONTACT == requestCode) {
        if (resultCode == Activity.RESULT_OK) {
            if (!handleResult(intent)) {
                handleError(CALL_CHOOSE_ERROR);
            }/*from  ww w.  j a v  a2s.c o  m*/
        }
    }
}