- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试解决突然弹出的日志异常。我以前从未见过它,但是,我大约有 5 周没有运行这个应用程序,所以也许它是由于任何更新或其他原因而产生的新内容。这是我的类(class)代码:
public class SplashScreen extends Activity {
// Splash screen timer
private static int SPLASH_TIME_OUT = 1000;
private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
private static final String TAG = "SplashPush";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
new Handler().postDelayed(new Runnable() {
/*
* Showing the splash screen for the selected time
*/
@Override
public void run() {
// Once the timer is over we will start the main activity
Intent i = new Intent(SplashScreen.this, ClientDriverMainScreen.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
if (checkPlayServices()) {
Intent i = new Intent(this, RegistrationIntentService.class);
startService(i);
}
}
/**
* Check the device to make sure it has the Google Play Services APK. If
* it doesn't, display a dialog that allows users to download the APK from
* the Google Play Store or enable it in the device's system settings.
*/
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
.show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
}
但我不断遇到异常:
Activity activiteslogic.splash.SplashScreen has leaked window.
有人有线索或提示要寻找什么吗?
完整的 Logcat:
08-22 12:41:03.609 1849-1849/zooz.ivmobs.com.zooz E/WindowManager: android.view.WindowLeaked: Activity activiteslogic.splash.SplashScreen has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{52860efc V.E..... R......D 0,0-1026,639} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:346)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:286)
at activiteslogic.splash.SplashScreen.checkPlayServices(SplashScreen.java:65)
at activiteslogic.splash.SplashScreen.onCreate(SplashScreen.java:48)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
最佳答案
用于将上下文 this 更改为 youractivity.this
if (checkPlayServices()) {
Intent i = new Intent(SplashScreen.this, RegistrationIntentService.class);
startService(i);
}
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(SplashScreen.this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(SplashScreen.this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
.show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
关于java - 泄露的窗口 com.android.internal.policy.impl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39080077/
大家晚上好! 在当前的项目中,我遇到了相当令人担忧的内存泄漏,但我似乎无法修复它。 我让应用程序在标准使用情况下运行过夜,当我在 8 小时后醒来时,它消耗了约 750MB 内存,而它一开始的内存约为
class MyViewController: UIViewController { @IBOutlet weak var webView: UIWebView? override
我的 sql 处理程序有问题 A SQLiteConnection object for database '/data/data/.../databases/queueManager' was le
我在引用 block 本身内的“NSBlockOperation”时遇到麻烦。我需要检查操作是否被取消,并且似乎在启用 ARC 的项目中运行时,对“searchOperation”的任何访问都会泄漏。
public class ProgressCircleActivity extends AppCompatActivity { private ProgressDialog progressB
Activity 泄漏是我可以为当前问题想到的最具体的术语。如果有其他情况,请指正。 场景:我创建了一个简单的 Android 测试应用程序来解决我的问题。我有一个 Activity ,一个添加到 f
我正在尝试创建身份验证系统,如果设备关闭 (SCREEN_OFF) 超过 INTERVAL,该系统会弹出登录窗口。 我已经注册了一个 BroadcastReceiver 来监听可启动 Activity
我想知道如果生产 key 被泄露需要采取哪些步骤。幸运的是,情况并非如此,但还是很高兴知道。 特别是,如果简单地将旧 key 交换为新生成的 key ,会发生什么情况?由于它用于生成哈希,是否会破坏整
我正在使用 Leak Canary 来跟踪内存泄漏,它说以下内容被泄漏: static hk.o references ht.a leaks MainActivity instance hk.o 和
-(NSDate *)dateFromDate:(NSDate *)inDate withNewTime:(NSDateComponents *)inTimeComponents { NSCalend
当我使用 AudioToolBox 播放音乐时,内存泄漏严重。 AVAudioPlayer *newMusicPlayer = [[AVAudioPlayer alloc] initWithData:
我使用 OpenAL 在我的应用程序中播放声音。当我使用 Instruments 工具测试它时,它发现了泄漏: LeakedObject = GeneralBlock-512 大小 = 512 字节
我需要捕获桌面图像并处理其 RGB 数据,我正在使用 Quartz API 来执行相同的操作, 我面临的问题是内存使用率高, 请引用函数, 在这里编辑,该函数是通过 pThread 调用的;像这样的东
我的 Android 应用程序中有一个 MapActivity,它使用 osmdroid(Open Street Map for Android 库)显示 map 。 当我在此 MapActivity
我在 fragment 中使用 AdMob。有时我会看到以下堆栈 10-23 14:27:38.916: E/ActivityThread(21250): Activity com.applegrew
我正在使用以下方式访问我的 API key ;这似乎是 recommended way ;但是当我将我的应用程序上传到 Play 管理中心时,运行预发布报告时出现严重错误。它说“泄漏的 GCP API
一家 3rd 方安全咨询公司在我们的 Angular SPA/ASP.NET WebAPI 应用程序中发现了 区域下的风险。信息公开 ,我们被告知要解决。 风险是由于 Angular 应用程序的性质,
在 Android 中,当读取 MIFARE Classic 卡时,使用 MifareClassic.authenticateSectorWithKeyA(或 authenticateSectorWi
加载谷歌地图时在分析器中获取泄漏。我根据谷歌的示例代码创建了一个非常简单的 View Controller ,我发现我在加载 map 时遇到了泄漏。我相信泄漏是在 SDK 本身。有没有人遇到过这个问题
我是一名优秀的程序员,十分优秀!