我想double
通过使用一个asynctask
类来获得两个值,并且应该progress-dialog
在这段时间内显示我该怎么做,有人请帮助我做到这一点,并给我一些关于这个主题的示例链接..
这是我的代码
public class MyAsyncTask extends AsyncTask<double, int, double>{
private Activity activity;
private ProgressDialog progressDialog;
private double lon;
private double lat;
public MyAsyncTask(Activity activity, double longitude, double latitute) {
super();
this.activity = activity;
this.lon = longitude;
this.lat = latitute;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(activity, "Loading", "Loading", true);
}
protected double doInBackground(double... v) {
//do your stuff here
if(lat==0.0&&lon==0.0)
return null;
}
@Override
protected void onPostExecute(Result result) {
progressDialog.dismiss();
MyAsyncTask task = new MyAsyncTask(MainActivity.this, gps.getLatitude(), gps.getLongitude());
task.execute();
Toast.makeText(activity.getApplicationContext(), "Finished.",
Toast.LENGTH_LONG).show();
}
}