java - how to display image from URL in android emulator -
how display image url using in emulator?
how display image url using in emulator?
at first need in background thread because requires networking operation can't perform on main(ui) thread. can in native thread or use more complex tool instance asynctask. need connect url , fetch data. have few options:
first: retrieve inputstream url , create new drawable:
inputstream inputstream = (inputstream) new url(yoururl).getcontent(); drawable drawable = drawable.createfromstream(inputstream, "srcname"); or can use approach requires more code write have @ this example.
note:
don't forget add proper permission manifest.xml
<uses-permission android:name="android.permission.internet"/>
Comments
Post a Comment