Draw A Graph In Android
I'm using a chart taken from here http://writerbay.wordpress.com/2011/03/12/android-tutorial-displaying-chart-on-android/#comment-54 to draw a graph in android. The data used for
Solution 1:
You have two options that I can see. The first would be easier to implement but harder on performance and that is to wife the display and draw the graph all over again reading in as many as you want. The second option would be to read in 4 points and draw those and then read in the next 4 and draw those in a new line and so on.
-= EDIT =-
publicclassInitTaskextendsAsyncTask<DBAdapter, Double, Void>
{
String TABLE_3;
protected Void doInBackground(DBAdapter... db)
{
try
{
// Like beforedo
{
doublex1= Double.parseDouble(c.getString(1));
doubley1= Double.parseDouble(c.getString(2));
doublex2= Double.parseDouble(c.getString(3));
doubley2= Double.parseDouble(c.getString(4));
doublex3= Double.parseDouble(c.getString(5));
doubley3= Double.parseDouble(c.getString(6));
doublex4= Double.parseDouble(c.getString(7));
doubley4= Double.parseDouble(c.getString(8));
publishProgress(x1, y1, x2, y2, x3, y3, x4, y4);
Thread.sleep(500);
} while (c.moveToNext());
// Like beforereturn;
}
protectedvoidonProgressUpdate(Double...values)
{
doublex1= values[0];
doubley1= values[1];
doublex2= values[2];
doubley2= values[3];
doublex3= values[4];
doubley3= values[5];
doublex4= values[6];
doubley4= values[7];
}
Post a Comment for "Draw A Graph In Android"