I’m reading some data from a DB in an AsyncTask thread….
in this way:
protected Void doInBackground(DBAdapter... db) {
try {
db[0].openDataBase();
Cursor c = db[0].getCursor3(db[0].TABLE_3, user_id);
float[] viteza = new float[c.getCount()];
String[] time = new String[c.getCount()];
if (c.moveToFirst()) {
do {
viteza[i] = Float.parseFloat(c.getString(3));
time[i] = c.getString(4);
publishProgress(????);
Thread.sleep(2500);
i++;
} while (c.moveToNext());
}
c.close();
db[0].close();
} catch (Exception e) {
Log.d("Eroare", "doInBackground", e);
}
return null;
}
My problem is that each time I get a new value for viteza[i] and time[i] I have to send them to
protected void onProgressUpdate(....?) {
}
both at the same time….but I don’t know how to do that cause publishProgress() can take only one parameter!!!!
Can someone help me with this?Thx
The following should work assuming you’ve got the data values in right order (getString(3) should be a number and getString(4) should be a time value).
A full AsyncTask to test passing values is here:
which prints the output: