【发布时间】:2016-01-03 12:59:36
【问题描述】:
我想将检索到的图像从 MySQL 显示到 android imageView(image),但得到 cannot resolve method setImageBitmap error。
private void showStaff(String json) {
try {
JSONObject jsonObject = new JSONObject(json);
JSONArray result = jsonObject.getJSONArray(Config.TAG_JSON_ARRAY);
JSONObject c = result.getJSONObject(0);
String type = c.getString(Config.TAG_TYPE).trim();
RetrieveType(type);
String Description = c.getString(Config.TAG_DESCRIPTION).trim();
String Amount=c.getString(Config.TAG_AMOUNT).trim();
String image=c.getString(Config.TAG_IMAGE);
byte[] data= Base64.decode(image,0);
Bitmap b=BitmapFactory.decodeByteArray(data,0,data.length);
image.setImageBitmap(b); // error
description.setText(Description);
amount.setText(Amount);
// noH.setText(hours);
} catch (JSONException e) {
e.printStackTrace();
}
我该如何解决这个问题?
【问题讨论】:
-
image是一个字符串? -
@DidierAupest 我从 MySQL 中检索到了它
-
@DidierAupest 我知道这里出了什么问题..我的 imageView 也命名为 image...
标签: android bitmap bitmapimage android-bitmap