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


Java Environment.DIRECTORY_DCIM屬性代碼示例

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


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

示例1: initData

private void initData() {
    File parent = new File(TextUtils.isEmpty(mFilePath) ? Environment.getExternalStorageDirectory() + File.separator
            + Environment.DIRECTORY_DCIM + File.separator + "weibo" : mFilePath);
    if (!parent.exists()) {
        parent.mkdirs();
    }

    mFile = new File(parent.getAbsolutePath() + File.separator + "weibo" + new Date().getTime()
            + ".mp4");
    mTotalController = TotalController.getInstance();
    mTotalController.initEncodeThread();
    setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
            return true;
        }
    });
}
 
開發者ID:sunshinecoast,項目名稱:ScreenRecordCaptureMaster,代碼行數:18,代碼來源:RecordScreenDialog.java

示例2: getRootPath

/**
 * 創建根緩存目錄
 *
 * @return
 */
public static String getRootPath(Context context) {
    String rootPath = "";
    if (isSdCardAvailable()) {
        // 圖片保存到相冊
        rootPath = Environment.getExternalStorageDirectory().getAbsolutePath()
                + File.separator + Environment.DIRECTORY_DCIM + File.separator + "Camera";
        File file = new File(rootPath);
        if (!file.exists()) {
            file.mkdirs();
        }
    } else {
        // /data/data/<application package>/cache
        rootPath = context.getCacheDir().getPath();
    }
    return rootPath;
}
 
開發者ID:liying2008,項目名稱:Simpler,代碼行數:21,代碼來源:FileUtils.java

示例3: initFile

private void initFile() {
    File parent = new File(TextUtils.isEmpty(mFilePath) ? Environment.getExternalStorageDirectory() + File.separator
            + Environment.DIRECTORY_DCIM + File.separator + "weibo" : mFilePath);
    if (!parent.exists()) {
        parent.mkdirs();
    }

    mFile = new File(parent.getAbsolutePath() + File.separator + "weibo" + new Date().getTime()
            + ".mp4");
}
 
開發者ID:sunshinecoast,項目名稱:ScreenRecordCaptureMaster,代碼行數:10,代碼來源:YZBRecordScreenDialog.java

示例4: capture

/**
     * 拍照
     */
    public static String capture(Activity activity, int requestCode) {
        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        String picName = null;
        if (cameraIntent.resolveActivity(activity.getPackageManager()) != null) {
            if (BaseConfig.sSDCardExist) {
                picName = Environment.getExternalStorageDirectory().getAbsolutePath() +
                        File.separator + Environment.DIRECTORY_DCIM + File.separator +
                        "Camera" + File.separator + activity.getString(R.string.app_name) +
                        "_" + System.currentTimeMillis() + ".jpg";

            } else {
                picName = activity.getCacheDir().getPath() + File.separator +
                        activity.getString(R.string.app_name) + "_" + System.currentTimeMillis() + ".jpg";
            }
            File photoFile = new File(picName);
//            FileUtils.createFile(photoFile);

            Uri uri = FileProvider.getUriForFile(activity,
                    App.getInstance().getApplicationId() + ".provider", photoFile);

            List<ResolveInfo> resInfoList = activity.getPackageManager()
                    .queryIntentActivities(cameraIntent, PackageManager.MATCH_DEFAULT_ONLY);
            for (ResolveInfo resolveInfo : resInfoList) {
                String packageName = resolveInfo.activityInfo.packageName;
                activity.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION
                        | Intent.FLAG_GRANT_READ_URI_PERMISSION);
            }
            cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
            activity.startActivityForResult(cameraIntent, requestCode);
        } else {
            AppToast.showToast(R.string.open_camera_failure);
        }
        return picName;
    }
 
開發者ID:liying2008,項目名稱:Simpler,代碼行數:37,代碼來源:CommonUtils.java

示例5: getPicturesSaveDir

public static String getPicturesSaveDir() {
	return FStoreLoc.BIGFILE.getCustomDirCreatableSdCard(get()).path + File.separator + Environment.DIRECTORY_DCIM + File.separator + Const.APP_DIR_NAME;
}
 
開發者ID:isuhao,項目名稱:QMark,代碼行數:3,代碼來源:App.java


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