棒棒糖发生故障但在KitKat中发挥作用

时间:2015-06-20 23:02:50

标签: android android-5.0-lollipop android-4.4-kitkat

我试图根据玩家在游戏中的表现给予玩家EndGame回复。

我访问方法" onDraw"从MainActivity显示消息。

它就像Kitkat的魅力一​​样,但在棒棒糖上它会以某种方式崩溃。

以下是代码:

在MainActivity中

if (rec.getGameOver()) {
            saveScore(rec.getScore());
            rec.onDraw(rec.getCanvas());
        }

在Game类中扩展视图

 if (score > value) {
            paint.setColor(Color.parseColor("#000000"));
            paint.setTextSize((int) (value));
            canvas1.drawText("Nice!", 0, (int) (value), paint);
            canvas1.drawText("Your got" + score, 0, (int) (value), paint);
        } else {
            paint.setColor(Color.parseColor("#000000"));
            paint.setTextSize((int) (value);
            canvas1.drawText("Try Again?!", 0, (int) (value), paint);
            canvas1.drawText("Your got" + score, 0, (int) (value), paint);
        }
        invalidate();

每个变量在使用前都已定义。

编辑:这是错误

06-20 16:14:51.656 1232-26777/? W/ActivityManager﹕ Exception thrown during pause android.os.DeadObjectException at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java:496) at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:704) at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:825) at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2726) at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2583) at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2497) at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:11500) at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11397) at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12081) at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:11592) at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)

0 个答案:

没有答案