• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Issue with show Image on the screen.

I am the blackberry developer.
I am new in android. I want to fetch image from url and show on the screen.
but image not showing on the screen.
this is my code.
public class UrlImage extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView imgview = (ImageView)findViewById(R.id.ImageView01);
Drawable draw = LoadImageFromWebOperations("http://www.androidpeople.com/wp-content/uploads/2010/03/android.png");
imgview.setImageDrawable(draw);
}
private Drawable LoadImageFromWebOperations(String url)
{
try
{
InputStream is = (InputStream)new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, url);
return d;
}catch(Exception ex)
{
System.out.println("Ex"+ ex);
return null;
}
}
}

What is the method of connection between simulator and internet.
Thanks
 
In your AndroidManifest.xml file go to the tab 'Permissions'.
Click on 'Add...' and select 'Uses permission'
Then on the right you need to select 'android.permission.INTERNET'
Save the file.

now you have the permission set and your app can use internet now.
 
Back
Top Bottom