URLから画像を取得して、に表示していimageview
ます。しかし、私のコードは私にnullメッセージを与えています。
ImageView imageview = (ImageView) findViewById(R.id.imageView1);
try {
Uri uri=Uri.parse("http://10.0.2.2:8083/call/rahul.jpg");
// uri.buildUpon().appendQueryParameter("key", "Android developer");
URI u = new URI(uri.toString());
System.out.println("path is "+u);
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet();
httpget.setURI(u);
//httpget.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
is = entity.getContent();
Bitmap bitmap = BitmapFactory.decodeStream(is);
imageview.setImageBitmap(bitmap);
} catch(Exception e) {
System.out.println("this is the error "+e.getMessage());
}
logcat:-
02-04 19:32:35.355: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:35.355: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:35.895: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:35.915: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:35.915: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:36.425: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:36.445: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:36.445: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:36.992: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:37.005: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:37.005: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:37.565: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:37.585: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:37.585: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:38.105: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:38.125: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:38.125: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:38.645: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:38.665: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:38.665: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:39.175: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:39.195: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:39.205: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'
02-04 19:32:39.695: I/dalvikvm(679): threadid=3: reacting to signal 3
02-04 19:32:39.716: D/dalvikvm(679): threadid=1: still suspended after undo (sc=1 dc=1)
02-04 19:32:39.716: I/dalvikvm(679): Wrote stack traces to '/data/anr/traces.txt'