当前位置: 首页>>代码示例>>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;未经允许,请勿转载。