本文整理汇总了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);
}
}
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}