谁能告诉我为什么即使我从服务器获取位图也没有创建它?我看了至少 15 个这样的问题,发现每件事几乎都一样,但我仍然找不到解决方案。如果可以,请自己尝试。URL也给出了。程序没有错误。谢谢
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://ademoproject.appspot.com/retrievedetails");
List<NameValuePair> list = new ArrayList<NameValuePair>();
list.add(new BasicNameValuePair("username",username));
UrlEncodedFormEntity urlencodedformentity = new UrlEncodedFormEntity(list);
httppost.setEntity(urlencodedformentity);
HttpResponse response = httpclient.execute(httppost);
BufferedReader br = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
Toast.makeText(this,br.readLine(), Toast.LENGTH_LONG).show();
byte []image=Base64.decode(br.readLine(), Base64.DEFAULT);
Bitmap bm = BitmapFactory.decodeByteArray(image, 0, image.length);
img.setImageBitmap(bm);