假设我在我的 Android 应用中创建了一个对话框,如下所示:
Say I have a created a dialog in my Android app like so:
private static ProgressDialog dialog;
dialog = ProgressDialog.show(MainActivity.this, "", "Downloading Files. Please wait...", true);
现在,是否可以在调用以下内容时触发事件?
Now, is it possible to fire an event when the following is called?
dialog.dismiss();
我想这样做而不只是在 dialog.dismiss(); 之后调用我的方法的原因是因为在静态类中调用了 Dialog 解除,而我接下来要做的是加载一个新的 Activity(这不能在静态类中使用 Intent 来完成).
The reason I want to do this and not just call my method after dialog.dismiss(); is because the Dialog dismiss is called within a static class and the next thing I want to do is load a new Activity (which cannot be done using Intents within a static class).
使用 OnDismissListener一个>.
有一个 setOnDismissListener(...) 类中的方法 Dialog
这篇关于当 Android Dialog 被解除时,你能触发一个事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
使用 GPS 获取用户的当前位置Get user#39;s current location using GPS(使用 GPS 获取用户的当前位置)
requestLocationUpdate() 抛出的 IllegalArgumentExceptionIllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 抛出的 IllegalArgumentException)
LocationManager 的 getLastKnownLocation 有多可靠,多久更How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新
如何检测位置提供者?GPS 或网络提供商How to detect Location Provider ? GPS or Network Provider(如何检测位置提供者?GPS 或网络提供商)
在应用启动期间获取当前位置Get current location during app launch(在应用启动期间获取当前位置)
locationManager.getLastKnownLocation() 返回 nulllocationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)