我想在屏幕上绘制折线时显示进度条。我知道折线仅在 UI 线程中绘制。我试过nextcode,但这没有帮助。没有进度对话框
final Handler mHandler = new Handler();
class shpLoading extends AsyncTask<Void, Void, Void> {
ProgressDialog dialog;
@Override
protected Void doInBackground(Void... params) {
mHandler.post(new Runnable() {
public void run() {
googleMap.addPolyline(new PolylineOptions()
.addAll(mRoutePoints)
.width(3)
.color(Color.RED));
}
});
return null;
}
@Override
protected void onPreExecute() {
Log.d("myLogs", "onPreExecute");
dialog = new ProgressDialog(getActivity());
dialog.setMessage("Kraunama...");
dialog.setIndeterminate(true);
dialog.setCancelable(false);
dialog.show();
}
@Override
protected void onPostExecute(Void result) {
Log.d("myLogs", "onPostExecute");
dialog.dismiss();
}
}
shpLoading shpLoading = new shpLoading();
shpLoading.execute();