nitinverma274
Newbie
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
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