Android:如何阻止执行活动直到locationupdate()?

时间:2010-11-20 17:05:46

标签: android android-activity gps

我需要阻止(无输入,不继续)执行活动,直到我有GPS坐标。我能怎么做? 感谢。

1 个答案:

答案 0 :(得分:0)

您可以使用捆绑的进度对话框运行AsyncTask(包含您的更新)。该对话框将阻止该活动。

请参阅此处的示例:

http://developer.android.com/reference/android/os/AsyncTask.html http://developer.android.com/reference/android/app/ProgressDialog.html

另一个有用的例子:

http://www.screaming-penguin.com/node/7746

更新:

Location location = null;
while(location != null) {
  location = requestLocation();
}
相关问题