我有一个应该在 AsyncTask 中运行的进度条,但它没有出现,尽管任务运行
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="@drawable/splashportrait">
<ProgressBar android:layout_alignParentBottom="true" android:indeterminate="true"
android:layout_centerHorizontal="true" android:paddingBottom="450dip"
android:layout_width="200dip" android:layout_height="200dip"
android:id="@+id/progressBar1"></ProgressBar>
</RelativeLayout>
CODE:
ProgressBar diagProgress;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
diagProgress = (ProgressBar)findViewById(R.id.progressBar1);
DiagnosticsTask diag = new DiagnosticsTask();
diag.execute();
/**rest of class ommitted here**/
}
private class DiagnosticsTask extends AsyncTask<String, String, Boolean> {
//Show spinner
protected void onPreExecute() {
//dialog.setMessage("Loading corresponding destinations...");
//dialog.show();
diagProgress.setVisibility(View.VISIBLE);
diagProgress.showContextMenu();
Log.e("AsyncStatus", "spinner shown");
}
/*other parts of the thread ommitted here*/
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)