Runnable image using android
i have a question, i want to runnable image with function runnable, but i
am failure, like what code to runnable image on this code ? can help me
with this problem ?
Intent intent = getIntent();
String url= intent.getStringExtra("URL");
tombol2 = (Button) findViewById(R.id.button2);
iv = (ImageView) findViewById(R.id.imageView1);
Drawable d1=LoadImageFromWebOperations(url);
iv.setImageDrawable(d1);
}
private Drawable LoadImageFromWebOperations(String url)
{
try
{
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
}catch (Exception e) {
System.out.println("Exc="+e);
return null;
}
}
}
No comments:
Post a Comment