图片文件上传到Parse

时间:2014-12-07 10:38:55

标签: java android camera parse-platform

我试图创建我的照片应用程序,定位于此示例http://www.androidhive.info/2013/09/android-working-with-camera-api/

       public void onClick(View view) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // create Intent to take a picture and return control to the calling application
            fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image
            intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
            startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); // start the image capture Intent
        }

我可以拍摄相机图片并在预览中显示。 现在我试图将我已经拍摄的图像上传到Parse,所以我试图像这样做

  

文件屏幕=新文件(fileUri.getPath());

     

...

     

ParseObject placeObject = new ParseObject(“Place”);

     

placeObject.put( “图像”,屏幕);

不幸发生以下异常:

  

java.lang.IllegalArgumentException:值的类型无效:class java.io.File

有人告诉我,我必须像在饭菜中那样缩放拍摄的照片,例如方法“saveScaledPhoto”(https://github.com/ParsePlatform/MealSpotting/blob/master/src/com/parse/mealspotting/CameraFragment.java)。 所以现在我的问题是,在我将其上传到Parse之前,我是否真的必须缩放我的图片,或者我是否正在创建一个主要的错误创建该文件?

0 个答案:

没有答案
相关问题