当前位置: 首页>>代码示例>>Java>>正文


Java Media.EXTERNAL_CONTENT_URI属性代码示例

本文整理汇总了Java中android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI属性的典型用法代码示例。如果您正苦于以下问题:Java Media.EXTERNAL_CONTENT_URI属性的具体用法?Java Media.EXTERNAL_CONTENT_URI怎么用?Java Media.EXTERNAL_CONTENT_URI使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.MediaStore.Images.Media的用法示例。


在下文中一共展示了Media.EXTERNAL_CONTENT_URI属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showFileChooser

private void showFileChooser() {
    Intent photoPickerIntent = new Intent(Intent.ACTION_PICK,
            Media.EXTERNAL_CONTENT_URI);
    photoPickerIntent.setType("image/*");
    photoPickerIntent.putExtra("crop", "true");
    photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
    photoPickerIntent.putExtra("outputFormat", CompressFormat.JPEG.toString());
    startActivityForResult(photoPickerIntent, PICK_IMAGE_REQUEST);
}
 
开发者ID:maysamrasoli,项目名称:Doctor,代码行数:9,代码来源:ActivitySendAds.java

示例2: onCreateLoader

public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (id == 0) {
        return new CursorLoader(MultiImageSelectorFragment.this.getActivity(), Media.EXTERNAL_CONTENT_URI, this.IMAGE_PROJECTION, null, null, this.IMAGE_PROJECTION[2] + " DESC");
    } else if (id != 1) {
        return null;
    } else {
        return new CursorLoader(MultiImageSelectorFragment.this.getActivity(), Media.EXTERNAL_CONTENT_URI, this.IMAGE_PROJECTION, this.IMAGE_PROJECTION[0] + " like '%" + args.getString("path") + "%'", null, this.IMAGE_PROJECTION[2] + " DESC");
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:MultiImageSelectorFragment.java

示例3: getPath

@SuppressLint({"NewApi"})
public String getPath(Context context, Uri uri) {
    boolean isKitKat;
    if (VERSION.SDK_INT >= 19) {
        isKitKat = true;
    } else {
        isKitKat = false;
    }
    if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
        String[] split;
        if (isExternalStorageDocument(uri)) {
            split = DocumentsContract.getDocumentId(uri).split(NetworkUtils.DELIMITER_COLON);
            if ("primary".equalsIgnoreCase(split[0])) {
                return Environment.getExternalStorageDirectory() + "/" + split[1];
            }
            return null;
        } else if (isDownloadsDocument(uri)) {
            return getDataColumn(context, ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(DocumentsContract.getDocumentId(uri)).longValue()), null, null);
        } else if (!isMediaDocument(uri)) {
            return null;
        } else {
            String type = DocumentsContract.getDocumentId(uri).split(NetworkUtils.DELIMITER_COLON)[0];
            Uri contentUri = null;
            if ("image".equals(type)) {
                contentUri = Media.EXTERNAL_CONTENT_URI;
            } else if ("video".equals(type)) {
                contentUri = Video.Media.EXTERNAL_CONTENT_URI;
            } else if ("audio".equals(type)) {
                contentUri = Audio.Media.EXTERNAL_CONTENT_URI;
            }
            String selection = "_id=?";
            return getDataColumn(context, contentUri, "_id=?", new String[]{split[1]});
        }
    } else if (WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT.equalsIgnoreCase(uri.getScheme())) {
        if (isGooglePhotosUri(uri)) {
            return uri.getLastPathSegment();
        }
        return getDataColumn(context, uri, null, null);
    } else if (IDataSource.SCHEME_FILE_TAG.equalsIgnoreCase(uri.getScheme())) {
        return uri.getPath();
    } else {
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:44,代码来源:FeedBackImageView.java

示例4: getPicPathFromUri

@TargetApi(19)
private String getPicPathFromUri(Uri uri) {
    boolean isKitKat;
    if (VERSION.SDK_INT >= 19) {
        isKitKat = true;
    } else {
        isKitKat = false;
    }
    if (isKitKat && DocumentsContract.isDocumentUri(this, uri)) {
        String[] split;
        if (isExternalStorageDocument(uri)) {
            split = DocumentsContract.getDocumentId(uri).split(com.letv.pp.utils.NetworkUtils.DELIMITER_COLON);
            if ("primary".equalsIgnoreCase(split[0])) {
                return Environment.getExternalStorageDirectory() + "/" + split[1];
            }
            return null;
        } else if (isDownloadsDocument(uri)) {
            return getDataColumn(this, ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(DocumentsContract.getDocumentId(uri)).longValue()), null, null);
        } else if (!isMediaDocument(uri)) {
            return null;
        } else {
            String type = DocumentsContract.getDocumentId(uri).split(com.letv.pp.utils.NetworkUtils.DELIMITER_COLON)[0];
            Uri contentUri = null;
            if ("image".equals(type)) {
                contentUri = Media.EXTERNAL_CONTENT_URI;
            } else if ("video".equals(type)) {
                contentUri = Video.Media.EXTERNAL_CONTENT_URI;
            } else if ("audio".equals(type)) {
                contentUri = Audio.Media.EXTERNAL_CONTENT_URI;
            }
            String selection = "_id=?";
            return getDataColumn(this, contentUri, "_id=?", new String[]{split[1]});
        }
    } else if (WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT.equalsIgnoreCase(uri.getScheme())) {
        if (isGooglePhotosUri(uri)) {
            return uri.getLastPathSegment();
        }
        return getDataColumn(this, uri, null, null);
    } else if (IDataSource.SCHEME_FILE_TAG.equalsIgnoreCase(uri.getScheme())) {
        return uri.getPath();
    } else {
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:44,代码来源:LetvBaseWebViewActivity.java

示例5: getContentUriTrigger

static ContentUriTrigger getContentUriTrigger() {
  ObservedUri contactUri =
      new ObservedUri(ContactsContract.AUTHORITY_URI, Flags.FLAG_NOTIFY_FOR_DESCENDANTS);
  ObservedUri imageUri = new ObservedUri(Media.EXTERNAL_CONTENT_URI, 0);
  return Trigger.contentUriTrigger(Arrays.asList(contactUri, imageUri));
}
 
开发者ID:firebase,项目名称:firebase-jobdispatcher-android,代码行数:6,代码来源:TestUtil.java

示例6: pickImage

public static void pickImage(Activity activity, int action) {

		Uri targetUri = Media.EXTERNAL_CONTENT_URI;
		String folderPath = DsaTabApplication.getDirectory(DsaTabApplication.DIR_PORTRAITS).getAbsolutePath();
		String folderBucketId = Integer.toString(folderPath.toLowerCase(Locale.GERMAN).hashCode());

		targetUri = targetUri.buildUpon().appendQueryParameter(ImageColumns.BUCKET_ID, folderBucketId).build();

		Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
		photoPickerIntent.setData(targetUri);

		activity.startActivityForResult(Intent.createChooser(photoPickerIntent, "Bild auswählen"), action);
	}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:13,代码来源:Util.java


注:本文中的android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。