0
我使用parse.com,检索图像时出现问题。这是代码:问题从parse.com中检索图像android
ParseFile fileObject = (ParseFile) comment.get("ac");
fileObject.getDataInBackground(new GetDataCallback() {
@Override
public void done(byte[] data,
ParseException e) {
if (e == null) {
// Decode the Byte[] into
// Bitmap
try {
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
// Get the ImageView from
// main.xml
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/imagesuri1/");
String fname = "image-"+ n +".jpg";
n++;
File file = new File (myDir, fname);
if (file.exists())
{file.delete();}
FileOutputStream out = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
out.close();
} catch (Exception b) {
b.printStackTrace();
}
// Close progress dialog
progressDialog.dismiss();
}
else {
Toast.makeText(getApplicationContext(), "ha abido un problema", Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
no++;
具体来说,问题是,我在parse.com 3个图像,我检索所有的图像,解码,并将其保存在SD卡上。有时图像像这样返回: (image-0.jpg - 0)(image-1.jpg - 1)(image-2.jpg - 2)。这就是我要的。有时图像会像这样返回:(image-0.jpg - 0)(image-2.jpg - 1)(image-1.jpg - 2)。我不明白为什么。
这是文件的大小检索问题吗?请帮助我的建议或解决方案,因为我真的不明白为什么它给了我这个结果(混乱),如果我正确地命令我的查询谢谢。