當前位置: 首頁>>代碼示例>>Java>>正文


Java AppCompatActivity.RESULT_OK屬性代碼示例

本文整理匯總了Java中android.support.v7.app.AppCompatActivity.RESULT_OK屬性的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatActivity.RESULT_OK屬性的具體用法?Java AppCompatActivity.RESULT_OK怎麽用?Java AppCompatActivity.RESULT_OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.support.v7.app.AppCompatActivity的用法示例。


在下文中一共展示了AppCompatActivity.RESULT_OK屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActivityResult

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

    if (requestCode == CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE && resultCode == AppCompatActivity.RESULT_OK) {
        Uri imageUri = CropImage.getPickImageResultUri(this, data);

        // For API >= 23 we need to check specifically that we have permissions to read external storage,
        // but we don't know if we need to for the URI so the simplest is to try open the stream and see if we get error.
        boolean requirePermissions = false;
        if (CropImage.isReadExternalStoragePermissionsRequired(this, imageUri)) {

            // request permissions and handle the result in onRequestPermissionsResult()
            requirePermissions = true;
            mCropImageUri = imageUri;
            requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE);
        } else {

            mCurrentFragment.setImageUri(imageUri);
        }
    }
}
 
開發者ID:chuch0805,項目名稱:Android-Demo_ImageCroper,代碼行數:23,代碼來源:MainActivity.java

示例2: onActivityResult

/**
 * 拍照完成通知係統添加照片
 *
 * @param requestCode requestCode
 * @param resultCode  resultCode
 * @param data        data
 */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == AppCompatActivity.RESULT_OK) {
        switch (requestCode) {
            case 0x03:
                if (mCamImageName == null) return;
                Uri localUri = Uri.fromFile(new File(Util.getCameraPath() + mCamImageName));
                Intent localIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, localUri);
                getActivity().sendBroadcast(localIntent);
                break;
            case 0x04:
                if (data == null) return;
                mOption.getCallback().doSelected(new String[]{data.getStringExtra("crop_path")});
                getActivity().finish();
                break;
        }
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:25,代碼來源:SelectFragment.java

示例3: onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
        case REQ_CODE_PICK_IMAGE: {
            if (resultCode == AppCompatActivity.RESULT_OK) {
                try {
                    Uri selectedImage = data.getData();

                    bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), selectedImage);
                    bitmap = scaleBitmap(bitmap);

                    groupPicture.setImageBitmap(bitmap);
                    groupPicture.startAnimation(AnimationUtils.loadAnimation(getContext(),
                            R.anim.anim_load_new_profile_picture));

                } catch (IOException e) {
                    Toast.makeText(getContext(), "Failed to load picture", Toast.LENGTH_LONG).show();
                }
            }
        }
        break;
    }
}
 
開發者ID:WGPlaner,項目名稱:wg_planer,代碼行數:23,代碼來源:CreateGroupFragment.java

示例4: onActivityResult

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

    switch (requestCode) {
        case REQ_CODE_PICK_IMAGE:
            if (resultCode == AppCompatActivity.RESULT_OK) {

                selectedImage = data.getData();

                try {
                    bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), selectedImage);
                    bitmap = scaleBitmap(bitmap);
                    image.setImageBitmap(bitmap);
                    image.startAnimation(AnimationUtils.loadAnimation(getContext(),
                            R.anim.anim_load_new_profile_picture));

                } catch (IOException e) {
                    Toast.makeText(getContext(), getString(R.string.load_profile_picture_error),
                        Toast.LENGTH_LONG).show();
                }
            }

            break;
    }
}
 
開發者ID:WGPlaner,項目名稱:wg_planer,代碼行數:26,代碼來源:UploadProfilePictureFragment.java

示例5: onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == AppCompatActivity.RESULT_OK && requestCode == 1) {
        mErrorLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
        mUserId = AccountHelper.getUserId();
        onRefreshing();
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:9,代碼來源:TweetFragment.java

示例6: onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == AppCompatActivity.RESULT_OK && requestCode == 1) {
        mLoading = false;
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:7,代碼來源:ShakePresentFragment.java

示例7: onActivityResult

/**
 * handling of connection fail popup
 * @param requestCode    popup request code
 * @param resultCode     popup result code
 * @param data           popup data
 * @return handling result
 */
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CONNECTION_FAILED_POPUP) {
        if (resultCode == AppCompatActivity.RESULT_OK) {
            connect();
        }
        return true;
    }
    return false;
}
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-sdk-android,代碼行數:16,代碼來源:GoogleDriveHandler.java

示例8: onActivityResult

@Override
protected void onActivityResult(final int requestCode, final int resultCode, @NonNull final Intent returnIntent)
{
	switch (requestCode)
	{
		case REQUEST_FILE_CODE:
			if (resultCode == AppCompatActivity.RESULT_OK)
			{
				final Uri fileUri = returnIntent.getData();
				if (fileUri == null)
				{
					break;
				}

				Toast.makeText(this, fileUri.toString(), Toast.LENGTH_SHORT).show();
				final File file = new File(fileUri.getPath());
				final String parent = file.getParent();
				final File parentFile = new File(parent);
				final Uri parentUri = Uri.fromFile(parentFile);
				final String query = file.getName();
				String base = parentUri.toString();
				if (base != null && !base.endsWith("/"))
				{
					base += '/';
				}
				Settings.save(this, query, base);

				updateButton();

				// query
				// query();
			}
			break;
		default:
			break;
	}
	super.onActivityResult(requestCode, resultCode, returnIntent);
}
 
開發者ID:1313ou,項目名稱:TreebolicPlugins,代碼行數:38,代碼來源:MainActivity.java

示例9: onActivityResult

@Override
protected void onActivityResult(final int requestCode, final int resultCode, @NonNull final Intent returnIntent)
{
	// handle selection of input by other activity which returns selected input
	if (resultCode == AppCompatActivity.RESULT_OK)
	{
		final Uri fileUri = returnIntent.getData();
		if (fileUri != null)
		{
			Toast.makeText(this, fileUri.toString(), Toast.LENGTH_SHORT).show();
			switch (requestCode)
			{
				case REQUEST_DIR_CODE:
					Settings.putStringPref(this, TreebolicIface.PREF_SOURCE, fileUri.getPath());

					updateButton();

					// query
					// query());
					break;
				default:
					break;
			}
		}
	}
	super.onActivityResult(requestCode, resultCode, returnIntent);
}
 
開發者ID:1313ou,項目名稱:TreebolicPlugins,代碼行數:27,代碼來源:MainActivity.java

示例10: onActivityResult

@Override
protected void onActivityResult(final int requestCode, final int resultCode, @NonNull final Intent returnIntent)
{
	// handle selection of input by other activity which returns selected input
	switch (requestCode)
	{
		case REQUEST_FILE_CODE:
		case REQUEST_BUNDLE_CODE:
		case REQUEST_SERIALIZED_CODE:
			if (resultCode == AppCompatActivity.RESULT_OK)
			{
				final Uri fileUri = returnIntent.getData();
				if (fileUri == null)
				{
					break;
				}

				Toast.makeText(this, fileUri.toString(), Toast.LENGTH_SHORT).show();
				switch (requestCode)
				{
					case REQUEST_FILE_CODE:
						setFolder(fileUri);
						tryStartTreebolic(fileUri);
						break;
					case REQUEST_BUNDLE_CODE:
						setFolder(fileUri);
						tryStartTreebolicBundle(fileUri);
						break;
					case REQUEST_SERIALIZED_CODE:
						setFolder(fileUri);
						tryStartTreebolicSerialized(fileUri);
						break;
					default:
						break;
				}
			}
			break;
		case REQUEST_DOWNLOAD_CODE:
			break;
		default:
			break;
	}
	super.onActivityResult(requestCode, resultCode, returnIntent);
}
 
開發者ID:1313ou,項目名稱:Treebolic,代碼行數:44,代碼來源:MainActivity.java


注:本文中的android.support.v7.app.AppCompatActivity.RESULT_OK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。