- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个我无法解决的问题...
在我的 Activity 中,我实例化了一个这样的类:
MapView mapView = (MapView) findViewById(R.id.mapview);<br/>
myMap = new Map(mapView, this);
构造函数看起来像这样
public Map(MapView mapView, Context context) {
this.context = context;
this.mapView = mapView;
}
我想做的是在这个类的过程中显示一个 progressDialog,所以,在 Map 中,我得到了
private void showPath() {
progressDialog = ProgressDialog.show(context, "Veuillez patienter", "Calcul de l'itinéraire en cours...", true, false);
Thread thread = new Thread(this);
thread.start();
}
当线程结束时,我做
progressDialog.dismiss();
这行得通!但只有一次......如果我点击后退按钮,并重新打开我的 Activity ,我得到一个 BadTokenException
05-06 23:27:15.941: ERROR/AndroidRuntime(1247): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@44ecc8e8 is not valid; is your activity running?
我已经尝试了我找到的所有解决方案,但没有一个有效...甚至使用扩展 AsyncTask 的类。
谢谢你的帮助
最佳答案
正如错误消息告诉您的那样,这是因为您尝试在 Activity 中显示对话框但 Activity 没有运行(已经完成?)。因此,在显示对话框之前,您可能需要确保 Activity 未完成:
public class MyActivity extends Activity {
public void showDialog(Dialog dialog) {
if (!isFinishing()) {
// If activity is not finished, then show this dialog.
dialog.show();
}
}
}
关于安卓 : BadTokenException when I want to show a progresssDialog a second time,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5921049/
我需要根据模板化参数返回正确的类型。我收到如下错误:有人可以建议解决这个问题的方法是什么吗?提前致谢。 error: no matching function for call to âsecond:
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: How to convert milliseconds to “hh:mm:ss” format? 我敢打赌很多人都
在脚本中,我使用 AJAX 从脚本请求数据。返回的数据以JSON格式返回。该脚本返回秒数,我正在寻找一种简单的方法来生成倒计时,显示返回值生成的分钟和秒数。 例如,如果脚本返回 90,我需要每秒显示一
为什么以下不抛出错误并返回 59 秒? # 2016-02-02T16:05:59+00:00 DateTime.strptime('02-02-2016 04:05:60 PM', '%d-%m-%
我想重新排列一个数据框,以便 1) 第一列始终保持在最前面,并且 2) 其余列的后半部分被拆分为每秒出现。 注意下面的例子 请查看示例数据: # Example data N # 1 A
我正在使用一个函数 HideFrame 来隐藏/显示两个 iframe 的左侧。该函数由使用按钮 image1 和 image2 的 onclick() 事件调用。 不幸的是,当我单击 image1
这个问题在这里已经有了答案: What is a non-capturing group in regular expressions? (18 个答案) 关闭 3 年前。 我正在尝试理解和练习以下
我可以请求一些关于子查询的帮助吗? 当我在本地 XAMP mySQL 数据库上运行查询时,查询需要 2 秒才能完成。然而,在我的网络服务器上使用相同的数据库,相同的查询需要 98 秒以上才能返回相同的
此处 unsigned long EVTime::seconds() 方法与 ptime p(d,seconds(s)); 冲突。如果我将 ptime seconds(s) 更改为分钟/小时,那么它工
GetSystemTimePreciseAsFileTime:以尽可能高的精度 (<1us) 检索当前系统日期和时间。 这给了我们一个 FILETIME 然后我们将它传递给:文件时间到系统时间这给了我
我现在面临的问题: 我有一个应用程序,它包含第一个 Activity MainActivity 和第二个名为 SecondActivity 的 Activity。现在,在这两个中我都需要一个单独的表:
我不明白为什么这个方法不起作用。使用 isEqualToDate: 时是否查看秒数和分秒数? //Test that the NSDate category's DatePlusDays: metho
在 http://www.cplusplus.com/reference/map/map/insert/ ,我对做 ret.first->second 的推理感到困惑或 it->second访问第二个
使用 Bash 脚本将 00:20:40.28 (HH:MM:SS) 转换为秒的简单方法是什么? 分秒可以剪掉,不是必须的。 最佳答案 试试 awk。作为奖励,您可以保留分秒。 echo "00:20
我正在尝试计算设定的日期时间对象和当前时间之间耗时。我希望它能够以这种格式出现 DD:HH:MM:SS 其中 DD 是天,HH 是小时,MM 是分钟,SS 是秒。我能够得到总天数、总小时数、总分钟数和
我仍然很新...所以, 我的问题的症结可以概括为:我正在准备将数据发送到远程API,这要求此字段为time.Duration类型,而我试图将其作为秒类型的字符串类型###s发送,并且time.Pars
我附和这个: php> echo date("Y-m-d\TH:i:s"); 2011-05-27T11:21:23 如何使用日期函数来获取这种日期格式: 2011-01-12T14:
我很好奇两者之间有什么区别。 irb(main):001:0> require 'active_support/core_ext' => true irb(main):002:0> 1.second.
浏览一些代码,我发现了两种每秒做某事的方法: for { fmt.Println("This is printed every second") time.Sleep(time.Sec
我正在使用 Sidekiq 在 AWS 服务器上创建 PDF 文档以在后台处理此作业。 在创建 PDF 文件的过程中,[Rails] 应用程序正在汇集数据库以检查是否创建了 PDF 文件(间隔:2 秒
我是一名优秀的程序员,十分优秀!