How to get image file from Google Chart API

by AlBasha » Wed, 29 Oct 2008 22:55:28 GMT

Sponsored Links
 I'm trying to get image file from Google Chart API.
Image link (strURL) = ;chd=t:37,0,50,12,1,0,0&chs=300x200&chl=Agriculture||Shrub/Grass|Trees|Built|Bare/Ice|Water&chco=FFFF66,ffffff,99FF66,006600,cc0000,cccc66,76A4FB&chf=bg,s,d3d3d3&chdl=Agriculture||Shrubs
and Grass|Trees|Built|Bare or Ice|Water&chdlp=b

Here is my java code:
URL url = new URL(strURL);
BufferedImage original =; ---> Error when reach here
byte[] data = write(original, "png");

Here is the error  :
javax.imageio.IIOException: Can't get input stream from URL!
at Source)

Any idea?


How to get image file from Google Chart API

by Ludwig » Thu, 30 Oct 2008 01:21:15 GMT

 I am surprised you got that far. I thought that javax.imageio was not part
of Android.
You should be able to do what you want like this (pseudo code):

inputstream = url.openStream()
bitmap = BitmapFactory.decodeStream(inputstream)

Using the url ;chd=t:37,0,50,12,1,0,0&chs=300x200
worked, but your longer posted one did not work then. I have not
investigated this further, might have to do with some of the special chars
not correctly encoded.


2008/10/29 AlBasha <[EMAIL PROTECTED]>


Sponsored Links

Other Threads

1. using google map search API

Is it possible to use google map search API in android?


2. requestLocationUpdates Problems

Hi Guys,

I just have a quick question about location updates. I don't know why
but it keeps saying I have an error on line 47, where I make the call
to start requesting location updates.

I don't know why but whenever i try to run the program on my AVD it
says that I have a NullPointerException on line 47, which I can't seem
to get through.

If you guys have any ideas, that would be very helpful. Thanks a

Here is the code from PasteBin


3. SDK couldn't load in Eclipse for some reason

4. are there functions available to control VPN ? (create profile, connect to, ... )

5. LED is not working

6. Android Emulator don't show up (Linux Fedora 12 x86_64)

7. What does "ERROR: thread attach failed" mean?