A
AquaBall
Fortgeschrittenes Mitglied
- 2
Ich versuche ein Image aus dem Internet zu laden.
Wenn ich es mit einer gespeicherten Ressource probiere läufts normal:
Aus dem Internet gelingts mir aber nicht:
Leider passiert nichts, obwohl das Bild existiert, auch keine exception.
LogMeldung:
Wenn ich es mit einer gespeicherten Ressource probiere läufts normal:
Code:
image.setImageResource(R.drawable.musterImage);
Code:
ImageView image= new ImageView(this);
String imageUrl="http://www.gettyicons.com/free-icons/101/real-vista-mobile/png/32/android_platform_32.png";
try {
Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageUrl).getContent());
image.setImageBitmap(bitmap);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
myLinearLayout.addView(image, new
LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
LogMeldung:
Code:
04-15 16:45:13.955: W/System.err(2543): java.net.UnknownHostException: www.gettyicons.com
04-15 16:45:13.965: W/System.err(2543): at java.net.InetAddress.lookupHostByName(InetAddress.java:506)
04-15 16:45:13.965: W/System.err(2543): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
04-15 16:45:13.976: W/System.err(2543): at java.net.InetAddress.getAllByName(InetAddress.java:256)
04-15 16:45:13.976: W/System.err(2543): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:69)
04-15 16:45:13.989: W/System.err(2543): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
04-15 16:45:13.989: W/System.err(2543): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)