Parse APIを使用してサーバーに画像をアップロードしようとしています。私はサーバーから読み取って、アップロードする画像を除くすべての列のデータを更新できます。あなたのコードでは、私は、デバイスから画像を拾い、ImageViewの中に表示されているparse APIを使用した画像アップロード
..
// Move to first row
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String imgDecodableString = cursor.getString(columnIndex);
cursor.close();
ImageView imageView = (ImageView) findViewById(R.id.imageView);
Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
// Set the Image in ImageView after decoding the String
imageView.setImageURI(selectedImage);
Picasso.with(this).load(selectedImage).fit().centerCrop().into(imageView);
//resizing the image part 2
ByteArrayOutputStream baos = new ByteArrayOutputStream();
//to Compress the image
//Quality Accepts 0 - 100
//0 = MAX Compression (Least Quality which is suitable for Small images)
//100 = Least Compression (MAX Quality which is suitable for Big images)
bitmap.compress(Bitmap.CompressFormat.PNG, 0, baos);
//uploading the image to server
byte[] imageInByte = imgDecodableString.getBytes();
final ParseFile bitmapFile = new ParseFile(imageInByte);
bitmapFile.saveInBackground();
//current user is already logged in.
ParseObject userDisplayImage = new ParseObject("UserDisplayImage");
userDisplayImage.put("photo", bitmapFile);
userDisplayImage.saveInBackground();
あなたは、サーバからの応答を取得してみてくださいその 'saveInBackground()' '使っsaveInBackground(新しいSaveCallback {...})'。また、次のようにして解析例外をチェックしてください。 'if(e!= null)e.printStacktrace();' – ZeekHuge
私は同じエラートースト "ヌル写真ファイル"を取得しました。私はサーバーから考えます。 – MAT