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