Cha*_*ham 1 java android image bitmap parse-platform
我想将图像添加到gridView.我从Parse.com上提取内容.我不会在资源文件夹中有它们,所以我找不到有用的教程.这是我到目前为止的代码;
progressDialog = ProgressDialog.show(manager.this, "", "Loading images...", true);
ParseQuery<ParseObject> query = ParseQuery.getQuery("fightGallery");
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> parseObjects, com.parse.ParseException e) {
if (e == null) {
int i = 0;
final int size = parseObjects.size();
while (i < size) {
ParseFile fileObject = parseObjects.get(i).getParseFile("image");
fileObject.getDataInBackground(new GetDataCallback() {
@Override
public void done(byte[] bytes, ParseException e) {
if (e == null) {
Log.d("Data", "We have data successfully");
Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
ImageView img = (ImageView) findViewById(R.id.imageView);
img.setImageBitmap(bmp);
Log.d("IMAGES", "IMAGES LOADED SUCCESSFULLY");
progressDialog.dismiss();
} else {
Log.d("ERROR: ", "" + e.getMessage());
progressDialog.dismiss();
}
}
});
i++;
}
} else {
Log.d("ERROR:", "" + e.getMessage());
progressDialog.dismiss();
}
}
});
Run Code Online (Sandbox Code Playgroud)
我应该如何将它添加到任何类型的图库中.我不挑剔.
| 归档时间: |
|
| 查看次数: |
1317 次 |
| 最近记录: |