I receive a double array from extras, then I need to do some things on background so I send double array to an asynctask. At this point I get an syntax error, so I would like like to now how to pass a double array (confparams) to asyntask.
My code:
final double confparams[]= extras.getDoubleArray("confparams");
AlertDialog.Builder builder = new AlertDialog.Builder(a_2_Att_Eleccion.this);
builder.setMessage(msg_calc)
.setTitle(R.string.a_2_dialWhatCalculateTitle)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
new Calculate_asyntask().execute(confparams);
}
});
builder.setNeutralButton("CANCEL",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked cancel button
return;
}
});
....................
public class Calculate_asyntask extends AsyncTask<double[], Integer, double[]> {
ProgressDialog progressDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(a_2_Att_Eleccion.this, getString(R.string.a_2_dialCalcTitle),getString(R.string.a_2_dialCalcMessage));
}
@Override
protected double[] doInBackground(double ... params) {
double final_result[] = new double[0];
if(result_sci[0]!=null){
a_3_CalcScill scill=new a_3_CalcScill();
sci=scill.CalcScill(result_sci,params,getApplicationContext());
final_result=sci;
}
return final_result;
}
So how can I send a doubleArray to an Asyntask?
The syntax double[] I used for asynctask for result works, but why not on the definition of asyntask and doInbackground for params?
Thanks in advance!