當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。