Without going into the subject at hand, i just want to mention that
sometimes the documentation is wrong... already came across a few functions
not doing what they say they would do.. so... should probably not rely on
that
On Wednesday, November 28, 2012 4:48:43 PM UTC-5, bob wrote:
>
>
> Just to clarify, here is the method you are calling with a bad input
> stream:
>
> public static Bitmap decodeStream (InputStream is)
> Added in API level 1
> Decode an input stream into a bitmap. If the input stream is null, or
> cannot be used to decode a bitmap, the function returns null. The stream's
> position will be where ever it was after the encoded data was read.
> Parameters
> is
> The input stream that holds the raw data to be decoded into a bitmap.
> Returns
> The decoded bitmap, or null if the image data could not be decoded.
>
>
> It must return null.
>
> In other words, it does not throw an exception.
>
> Neither does setImageBitmap when you do setImageBitmap(null);
>
>
> On Monday, November 26, 2012 7:45:05 PM UTC-6, Gabriel Higareda wrote:
>>
>> Sorry to be posting but I can't see my posts on the group page: This is
>> the code that is giving me trouble:
>>
>> try{
>> URL url = new URL("
>> http://en.wikipedia.org/wiki/File:Polar_Bear_-_Alaska.jpg");
>> HttpURLConnection connection = (HttpURLConnection)
>> url.openConnection();
>>
>> InputStream is = connection.getInputStream();
>> Bitmap img = BitmapFactory.decodeStream(is);
>>
>> animalPhoto.setImageBitmap(img );
>> }catch(Exception e){
>> Toast.makeText(this,"IO Exception",
>> Toast.LENGTH_LONG).show();
>> }
>>
>> But when i run my app, no picture is shown and my catch message shows...
>> Not sure what is going on.
>>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en