【发布时间】:2011-07-03 14:40:04
【问题描述】:
如果用户长按列表项,我需要使用 MapView 显示活动。 这个过程需要一段时间,所以我想在应用程序挂起时显示用户进度对话框。 代码如下:
ListView listView = (ListView) findViewById(android.R.id.list);
listView.setOnItemLongClickListener (new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView parent, View view, int position, long id) {
...
ProgressDialog dialog = ProgressDialog.show(getApplicationContext(), "", "Loading. Please wait...", true);
Intent intent = new Intent(getBaseContext(), Map.class);
startActivity(intent);
我选择了正确的方法吗?现在获取不同的 FC(取决于为 ProgressDialog 选择的上下文)。我的场景中可以显示 ProgressBar 吗?
更新。我试图在开始活动之前展示 Toast。同样,Toast 仅在 Map 已显示时才显示。不明白会发生什么。如果我删除 startActivity 代码,则立即显示 Toast。
【问题讨论】:
标签: android dialog progressdialog android-progressbar