how using 'do while' in asynctask for add to array list?Please explain mobile code,Thanks to all those who respond
code :
public List<msgstore> results =new ArrayList<msgstore>();
AsyncTask<Void, Void, Void>task=new AsyncTask<Void, Void, Void>(){
ProgressDialog pd = new ProgressDialog(mContext);
@Override
protected void onPreExecute() {
pd.setTitle("Process");
pd.setMessage("Processing ....");
pd.setCancelable(false);
pd.setIndeterminate(true);
pd.show();
}
@Override
protected Void doInBackground(Void... params) {
do{
String d=mCur.getString(mCur.getColumnIndex("address"));
String p= mCur.getString(mCur.getColumnIndex("phone"));
int k=mCur.getInt(mCur.getColumnIndex("key"));
int i=mCur.getInt(mCur.getColumnIndex("_id"));
long t=mCur.getLong(mCur.getColumnIndex("registertime"));
results.add(new msgstore(d,p,k,i,t));
}while(mCur.moveToNext());
return null;
}
@Override
protected void onPostExecute(Void result) {
pd.dismiss();
}
};
task.execute((Void[])null);