gpt4 book ai didi

java.lang.IllegalArgumentException :at android. view.Surface.unlockCanvasAndPost( native 方法)

转载 作者:行者123 更新时间:2023-12-01 07:58:48 26 4
gpt4 key购买 nike

这个问题我找了两天了。我知道这是由一些愚蠢的错误引起的,但我找不到那个东西。如果有人帮助我,那就太好了。这是 fragment

private void draw() {
final SurfaceHolder holder = getSurfaceHolder();

Canvas c = holder.lockCanvas();;

try {
update(c);
updateText(c); //These are the effects like snowing or bouncing
} finally {
if (c != null)
holder.unlockCanvasAndPost(c); //This is line no. 151
}

mHandler.removeCallbacks(drawRunner);
if (mVisible) {
mHandler.postDelayed(drawRunner, 10);
}
}

我认为问题出在上述方法中。这是日志猫:

 11-18 11:29:15.145: E/AndroidRuntime(2845): java.lang.IllegalArgumentException
11-18 11:29:15.145: E/AndroidRuntime(2845): at android.view.Surface.unlockCanvasAndPost(Native Method)

11-18 11:29:15.145: E/AndroidRuntime(2845): at com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)

11-18 11:29:15.145: E/AndroidRuntime(2845): at com.example.livewallpaper.SnowEffect$MyBounce.draw(SnowEffect.java:151)

11-18 11:29:15.145: E/AndroidRuntime(2845): at com.example.livewallpaper.SnowEffect$MyBounce.access$0(SnowEffect.java:141)

11-18 11:29:15.145: E/AndroidRuntime(2845): at com.example.livewallpaper.SnowEffect$MyBounce$1.run(SnowEffect.java:55)

最佳答案

问题解决了。

如果有人遇到同样的问题,这里是解决方案,这是一个非常愚蠢的错误。更新您的 list 文件。

<activity
android:name="com.yourpackage.Prefs"
android:exported="true" >
<intent-filter>
<category android:name="android.intent.category.PREFERENCE" />
</intent-filter>
</activity>

不要忘记添加 android:exported="true"。我真的错过了!

关于java.lang.IllegalArgumentException :at android. view.Surface.unlockCanvasAndPost( native 方法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26987728/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com