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

Apps Inputstream with an image from a url (HTC phone - won't work)

lms5400

Newbie
try{
URL aURL = new URL("some_valid_url.jpg");
InputStream is = (InputStream)aURL.getContent();
Drawable image = Drawable.createFromStream(is, "src");
myButton.setImageDrawable(image);
is.close();
}
...


All images tested so far work on the simulator and my htc g1 phone, but some won't work on my htc hero phone and no exceptions are thrown. I also tried bufferedinputstream with the same results. Some images work on my htc and some don't. could this be a jpg formatting issue or could I be missing something?
 
try{
URL aURL = new URL("some_valid_url.jpg");
InputStream is = (InputStream)aURL.getContent();
Drawable image = Drawable.createFromStream(is, "src");
myButton.setImageDrawable(image);
is.close();
}
...


All images tested so far work on the simulator and my htc g1 phone, but some won't work on my htc hero phone and no exceptions are thrown. I also tried bufferedinputstream with the same results. Some images work on my htc and some don't. could this be a jpg formatting issue or could I be missing something?

Have you tried debugging using eclipse's tools through USB debugging? It could or could not be the type of image you're using. Only way to find out is to try a png or gif or bmp image or something.
 
Back
Top Bottom