zoukankan      html  css  js  c++  java
  • 团队冲刺第二阶段09

    做好了拍照的功能,增加了上传录制摄的功能。

    部分代码:

    private void takePhoto () {
        // Checks for camera app available
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (!IntentChecker.isAvailable(mainActivity, intent, new String[]{PackageManager.FEATURE_CAMERA})) {
          mainActivity.showMessage(R.string.feature_not_available_on_this_device, ONStyle.ALERT);
    
          return;
        }
        // Checks for created file validity
        File f = StorageHelper.createNewAttachmentFile(mainActivity, MIME_TYPE_IMAGE_EXT);
        if (f == null) {
          mainActivity.showMessage(R.string.error, ONStyle.ALERT);
          return;
        }
        attachmentUri = FileProviderHelper.getFileProvider(f);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, attachmentUri);
        startActivityForResult(intent, TAKE_PHOTO);
      }
    private void takeVideo () {
    Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    if (!IntentChecker.isAvailable(mainActivity, takeVideoIntent, new String[]{PackageManager.FEATURE_CAMERA})) {
    mainActivity.showMessage(R.string.feature_not_available_on_this_device, ONStyle.ALERT);

    return;
    }
     
  • 相关阅读:
    Problem C: 类的初体验(V)
    接口与继承
    类和对象
    java函数方法
    数组
    string类的一些函数方法
    java语法基础
    大道至简——做个懒人
    java编程 求和
    编程的精义
  • 原文地址:https://www.cnblogs.com/xjmm/p/13085456.html
Copyright © 2011-2022 走看看