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. Nested Table layout not showing

Hi all,

in my view i have the need to a somewhat different layout. It needs to
display a table within each row a cell for a thumbnail and a cell for
displaying a title and a description. The title and description should
be displayed on top of eachother, so something like:

|                  |
title                                                |
|    thumb     |    description                                     |
|                                                         |

In this case i thought i'd use a nested table layout:

TableLayout tl = (TableLayout) findViewById(;

int i=0;
for (FeedMessage message : f.getMessages()) {
        // Create a TableRow and give it an ID
            TableRow tr = new TableRow(this);
            tr.setLayoutParams(new TableLayout.LayoutParams(

            // setup a new table for the title and the description
            TableLayout table = new TableLayout(this);
            table.setLayoutParams(new TableRow.LayoutParams(

            // setup the rows for the textviews
            TableRow titleRow = new TableRow(this);
            TableRow descriptionRow = new TableRow(this);

            // construct the views
            TextView titleView = getTitleView(message);
            TextView descriptionView = getDescriptionView(message);
            ImageView thumbView = (ImageView) getThumbView(message);




I get no exceptions, messages are real objects, but the table just
ain't displaying. Any thoughts?




2. Background Service is not working.

Hello. i wish to use implement Service in my application to display a
message on the screen. This service should run while my application is
running. But right now, i just want to test the service function and
the Service doesn't seem to work well.

In the main java file, i call startService(new Intent

And the code is as below.

package com.example.helloandroid;

import android.content.Intent;
import android.os.IBinder;
import android.widget.Toast;

public class testing extends Service{

    public void onCreate() {
                Toast mToast = Toast.makeText(this, R.string.app_name,

        public IBinder onBind(Intent arg0) {
                // TODO Auto-generated method stub
                return null;


Why it isn't displaying the Toast message? Can anyone help please!!!


3. READ/WRITE HISTORY BOOKMARKS permissions broken???

4. SoundPool problem

5. blackberry emulator on android

6. Accessing images from gallery

7. Need to re-initialize or kill the acore process silently