-1
我找不出解決方案來從解析表中檢索圖像並將其顯示在Listview中的Imageview中。 這是我到目前爲止有:在ListView中解析檢索到的圖像Android
if (mSchedule.getCount() == 0) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("sent_report");
query.selectKeys(Arrays.asList("Logo"));
query.selectKeys(Arrays.asList("Couleur"));
query.selectKeys(Arrays.asList("Date"));
query.selectKeys(Arrays.asList("Rog_pic"));
query.findInBackground(new FindCallback<ParseObject>() {
int i = 0;
Bitmap bmp;
public void done(List<ParseObject> names, ParseException e) {
if (e == null) {
for (ParseObject post : names) {
postTexts.add(post.getString("Logo"));
postTexts.add(post.getString("Couleur"));
postTexts.add(post.getString("Date"));
ParseFile image = (ParseFile) post.get("Rog_pic");
image.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
} else {
Log.d("test", "There was a problem downloading the data.");
}
}
});
map = new HashMap<String, Object>();
map.put("nom", postTexts.get(i));
i++;
map.put("titre", postTexts.get(i));
i++;
map.put("description", postTexts.get(i));
i++;
map.put("img", bmp);
listItem.add(map);
mSchedule.notifyDataSetChanged();
}
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
}
mSchedule是SimpleAdapter。我嘗試了很多東西來使它工作。我檢查了,並且ParseFile不爲空,那麼爲什麼Imageview中不顯示圖像? 在此先感謝。