android - send double[] to Asynctask -
i receive double array extras, need things on background send double array asynctask. @ point syntax error, like how pass double array (confparams) 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 send doublearray asyntask?
the syntax double[] used asynctask result works, why not on definition of asyntask , doinbackground params?
thanks in advance!
change following:
@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; }
Comments
Post a Comment