I am utilizing a chart obtained from here http://writerbay.wordpress.com/2011/03/12/android-tutorial-displaying-chart-on-android/#comment-54

to attract a graph in android. The information employed for drawing the graph is obtained from a DB. On x axis I place the data as well as on the y-axis I put some amounts meaning the rate.

The information from DB is readed using Async thread.

Things I wanna do may be the following:

*read four values for data and four values for speed and use them the chart

*reading through the next four values increase my chart....before the data in the DB is readed

The issue I am facing is the fact that:

LineView lv my chart includes a constructor that accepts as parameters only arrays[]

So I must pass it the array that contains the entire data....that is against what I wish to do.

public class InitTask extends AsyncTask<DBAdapter,String, Void> {

    String TABLE_3;

    protected Void doInBackground(DBAdapter... db) {
        try {
            db[0].createDatabase();
            db[0].openDataBase();
            Cursor c = db[0].getCursor3(db[0].TABLE_3, user_id);


            viteza = new float[4];
            time = new String[4];

            if (c.moveToFirst()) {

                do {
                    int a=(int)Double.parseDouble(c.getString(3));

                    publishProgress(Integer.toString(a),c.getString(4));
                    Thread.sleep(500);


                } while (c.moveToNext());

            }
            c.close();
            db[0].close();

        } catch (Exception e) {
            Log.d("Eroare", "doInBackground", e);
        }

        return null;
    }

    protected void onProgressUpdate(String...values) {

        Aitem items[] = new Aitem[1];

      viteza[contor]=Float.parseFloat(values[0]);

     time[contor]=values[1];


        items[0]=new Aitem(Color.RED, "Evolution",viteza);


        lv.setAxisValueX(time);

    lv.setItems(items);


        setContentView(lv);
        }

}

time is definitely an array-that contains my data that we placed on the x-axis it should be a String

viteza-is perfect for speed and it is an assortment which consists of float amounts.

This is the way I obtaing the graph:

products[]=new Aitem(Color.Red-colored, "Evolution",viteza)

lv.setItems(products)

However , the Aitem() constructor needs arrays[] String as parameters....and I am unable to try to update that array[] using the new values(four vnew values step-by-step)

failing to remember concerning the original copies..

So in an instant only four values are shown on my graph....

However , I'm not sure how to achieve that...

Has anybody any clue of methods could I actually do that...Thank u!

EDIT:initial value for contor=

You've two options will be able to see. The very first could be simpler to implement but harder on performance which would be to wife the display and draw the graph once again reading through in as much as you would like. The 2nd option is to see in 4 points and draw individuals after which read within the next 4 and draw individuals inside a new line and so forth.

-= EDIT =-

public class InitTask extends AsyncTask<DBAdapter, Double, Void> 
{
    String TABLE_3;

    protected Void doInBackground(DBAdapter... db)
    {
        try
        {

            // Like before

            do
            {
                double x1 = Double.parseDouble(c.getString(1));
                double y1 = Double.parseDouble(c.getString(2));
                double x2 = Double.parseDouble(c.getString(3));
                double y2 = Double.parseDouble(c.getString(4));
                double x3 = Double.parseDouble(c.getString(5));
                double y3 = Double.parseDouble(c.getString(6));
                double x4 = Double.parseDouble(c.getString(7));
                double y4 = Double.parseDouble(c.getString(8));

                publishProgress(x1, y1, x2, y2, x3, y3, x4, y4);
                Thread.sleep(500);
            } while (c.moveToNext());

            // Like before

            return;
    }

protected void onProgressUpdate(Double...values)
{
    double x1 = values[0];
    double y1 = values[1];
    double x2 = values[2];
    double y2 = values[3];
    double x3 = values[4];
    double y3 = values[5];
    double x4 = values[6];
    double y4 = values[7];
}