android-intent - 在 setContentView ( ) 中,应用崩溃

  显示原文与译文双语对照的内容
88 0

我试图设置一个闪屏来工作 5秒,然后打开另一个 Intent,但是打开了它的模拟器 。


09-23 11:21:22.135: W/EGL_emulation(2204): eglSurfaceAttrib not implemented
09-23 11:21:22.605: I/Process(2204): Sending signal. PID: 2204 SIG: 9
09-23 11:21:31.805: D/dalvikvm(2222): GC_FOR_ALLOC freed 66K, 8% free 2583K/2780K, paused 2ms, total 4ms
09-23 11:21:31.805: I/dalvikvm-heap(2222): Grow heap (frag case) to 4.549MB for 1997580-byte allocation
09-23 11:21:31.825: D/dalvikvm(2222): GC_FOR_ALLOC freed 2K, 5% free 4531K/4732K, paused 2ms, total 2ms
09-23 11:21:31.955: W/dalvikvm(2222): threadid=11: thread exiting with uncaught exception (group=0xb2ef8648)
09-23 11:21:31.955: E/AndroidRuntime(2222): FATAL EXCEPTION: Thread-105
09-23 11:21:31.955: E/AndroidRuntime(2222): java.lang.IllegalMonitorStateException: object not locked by thread before wait()
09-23 11:21:31.955: E/AndroidRuntime(2222): at java.lang.Object.wait(Native Method)
09-23 11:21:31.955: E/AndroidRuntime(2222): at java.lang.Object.wait(Object.java:401)
09-23 11:21:31.955: E/AndroidRuntime(2222): at com.app.locator.Splash$1.run(Splash.java:19)
09-23 11:21:31.995: D/libEGL(2222): loaded/system/lib/egl/libEGL_emulation.so
09-23 11:21:31.995: D/(2222): HostConnection::get() New Host Connection established 0xb9481bf0, tid 2222
09-23 11:21:32.025: D/libEGL(2222): loaded/system/lib/egl/libGLESv1_CM_emulation.so
09-23 11:21:32.025: D/libEGL(2222): loaded/system/lib/egl/libGLESv2_emulation.so
09-23 11:21:32.255: W/EGL_emulation(2222): eglSurfaceAttrib not implemented
09-23 11:21:32.295: D/OpenGLRenderer(2222): Enabling debug mode 0
09-23 11:21:32.945: W/EGL_emulation(2222): eglSurfaceAttrib not implemented

时间: 原作者:

107 2

看起来你的闪屏使用的位图太大了。 试着把降低一点。 例如:


 final DisplayMetrics metrics = getResources().getDisplayMetrics();
//get splash image width, it will be equal display width
 final int windowWidth = metrics.widthPixels;

 final int statusBarHeight = (int) Math.ceil(STATUS_BAR_HEIGHT * getResources().getDisplayMetrics().density);
//get splash image height (display height - status bar height)
 final int windowHeight = metrics.heightPixels - statusBarHeight;

 final BitmapFactory.Options options = new BitmapFactory.Options();
 options.inJustDecodeBounds = true;
 final int inSampleSize = ImageUtils.calculateInSampleSize(options, windowWidth, windowHeight);
 options.inSampleSize = inSampleSize;
 options.inJustDecodeBounds = false;

 final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resId, options);

...