点按设置时,动态壁纸崩溃 [英] Live Wallpaper crash when tap on Settings
本文介绍了点按设置时,动态壁纸崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
总是当我点击动态壁纸选择器中的设置... 按钮停止。然后停止我的动态壁纸。
wallpaper.xml
p> <?xml version =1.0encoding =UTF-8?&
< wallpaper xmlns:android =http://schemas.android.com/apk/res/android
android:thumbnail =@ drawable / ic_bubbles
android:name =@ string / app_name
android:description =@ string / app_name
android:settingsActivity =com.chovanec.bubbles.Settings_activity/>
Settings_activity.java
package com.chovanec.bubbles;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class Settings_activity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
Log.d(activity onCreate );
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_layout);
}
@Override
public boolean onCreateOptionsMenu(菜单菜单){
return true;
}
}
settings_layout.xml / p>
< RelativeLayout xmlns:android =http://schemas.android.com/apk/res/android
xmlns:tools =http://schemas.android.com/tools
android:layout_width =match_parent
android:layout_height =match_parent>
&TextView
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_centerHorizontal =true
android: layout_centerVertical =true
android:text =Hello,world!
tools:context =。Settings_activity/>
< / RelativeLayout>
AndroidManifest.xml
< manifest xmlns:android =http://schemas.android.com/apk/res/android
package =com.chovanec.bubbles
android:versionCode =3
android:versionName =1.2>
< uses-sdk android:minSdkVersion =8android:targetSdkVersion =15/>
< application android:label =@ string / app_name
android:icon =@ drawable / ic_bubbles
android:theme =@ style / AppTheme ;
< service android:label =Bubbles by MCh
android:name =Bubbles
android:permission =android.permission.BIND_WALLPAPER>
< intent-filter>
< action android:name =android.service.wallpaper.WallpaperService/>
< / intent-filter>
< meta-data android:name =android.service.wallpaper
android:resource =@ xml / wallpaper/&
< / service>
< / application>
< uses-feature android:name =android.software.live_wallpaper/>
< / manifest>
LogCat
这里是logcat
01-11 10:57:37.990:E / Trace(1960):错误打开跟踪文件:没有这样的文件或目录b 01-11 10:57:38.150:D / gralloc_goldfish(1960):没有检测到GPU仿真的仿真器。
01-11 10:57:57.801:E / SurfaceTextureClient(1960):queueBuffer:表面纹理的错误队列缓冲区,-19
01-11 10:57:57.801:E / SurfaceTextureClient queueBuffer(handle = 0x2a1099b0)失败(没有这样的设备)
01-11 10:57:57.801:D / AndroidRuntime(1960):关闭VM
01-11 10:57:57.801: dalvikvm(1960):threadid = 1:线程以未捕获异常退出(组= 0x40a13300)
01-11 10:57:57.940:E / AndroidRuntime(1960):FATAL EXCEPTION:main
01-11 10:57:57.940:E / AndroidRuntime(1960):java.lang.IllegalArgumentException
01-11 10:57:57.940:E / AndroidRuntime(1960):在android.view.Surface.unlockCanvasAndPost
01-11 10:57:57.940:E / AndroidRuntime(1960):at com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)
01-11 10:57: 57.940:E / AndroidRuntime(1960):at com.chovanec.bubbles.Bubbles $ BubblesEngine.draw(Bubbles.java:116)
01-11 10:57:57.940:E / AndroidRuntime(1960):at com .chovanec.bubbles.Bubbles $ BubblesEngine.access $ 0(Bubbles.java:68)
01-11 10:57:57.940:E / AndroidRuntime(1960):at com.chovanec.bubbles.Bubbles $ BubblesEngine $ 1。 run(Bubbles.java:50)
01-11 10:57:57.940:E / AndroidRuntime(1960):在android.os.Handler.handleCallback(Handler.java:615)
01-11 10:57:57.940:E / AndroidRuntime(1960):在android.os.Handler.dispatchMessage(Handler.java:92)
01-11 10:57:57.940:E / AndroidRuntime .os.Looper.loop(Looper.java:137)
01-11 10:57:57.940:E / AndroidRuntime(1960):在android.app.ActivityThread.main(ActivityThread.java:4745)
01-11 10:57:57.940:E / AndroidRuntime(1960):at java.lang.reflect.Method.invokeNative(本地方法)
01-11 10:57:57.940:E / AndroidRuntime ):at java.lang.reflect.Method.invoke(Method.java:511)
01-11 10:57:57.940:E / AndroidRuntime(1960):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:786)
01-11 10:57:57.940:E / AndroidRuntime(1960):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-11 10:57:57.940:E / AndroidRuntime(1960):at dalvik.system.NativeStart.main(本地方法)
01-11 10:58:00.360: :发送信号。 PID:1960 SIG:9
01-11 10:58:05.590:E / Trace(1994):错误打开跟踪文件:没有这样的文件或目录(2)
01-11 10:58: 05.920:D / gralloc_goldfish(1994):没有检测到GPU仿真的仿真器。
01-11 10:58:32.749:D / dalvikvm(1994):GC_CONCURRENT释放47K,2%释放8356K / 8455K,暂停73ms + 42ms,总计271ms
解决方案
需要在 manfiest.xml中声明您的活动
/ p>
< activity
android:name =。Settings_activity
android:configChanges =keyboardHidden | orientation
android:exported =true/>
allways when i tap on Settings... button in Live Wallpaper Picker it stop. And then stop my Live Wallpaper too.
Can you help me?
wallpaper.xml
<?xml version="1.0" encoding="UTF-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@drawable/ic_bubbles"
android:name="@string/app_name"
android:description="@string/app_name"
android:settingsActivity="com.chovanec.bubbles.Settings_activity"/>
Settings_activity.java
package com.chovanec.bubbles;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class Settings_activity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d("activity onCreate", "");
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_layout);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
}
settings_layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Hello, world!"
tools:context=".Settings_activity" />
</RelativeLayout>
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chovanec.bubbles"
android:versionCode="3"
android:versionName="1.2">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
<application android:label="@string/app_name"
android:icon="@drawable/ic_bubbles"
android:theme="@style/AppTheme">
<service android:label="Bubbles by MCh"
android:name="Bubbles"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/wallpaper" />
</service>
</application>
<uses-feature android:name="android.software.live_wallpaper" />
</manifest>
LogCat here is logcat
01-11 10:57:37.990: E/Trace(1960): error opening trace file: No such file or directory (2)
01-11 10:57:38.150: D/gralloc_goldfish(1960): Emulator without GPU emulation detected.
01-11 10:57:57.801: E/SurfaceTextureClient(1960): queueBuffer: error queuing buffer to SurfaceTexture, -19
01-11 10:57:57.801: E/SurfaceTextureClient(1960): queueBuffer (handle=0x2a1099b0) failed (No such device)
01-11 10:57:57.801: D/AndroidRuntime(1960): Shutting down VM
01-11 10:57:57.801: W/dalvikvm(1960): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
01-11 10:57:57.940: E/AndroidRuntime(1960): FATAL EXCEPTION: main
01-11 10:57:57.940: E/AndroidRuntime(1960): java.lang.IllegalArgumentException
01-11 10:57:57.940: E/AndroidRuntime(1960): at android.view.Surface.unlockCanvasAndPost(Native Method)
01-11 10:57:57.940: E/AndroidRuntime(1960): at com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)
01-11 10:57:57.940: E/AndroidRuntime(1960): at com.chovanec.bubbles.Bubbles$BubblesEngine.draw(Bubbles.java:116)
01-11 10:57:57.940: E/AndroidRuntime(1960): at com.chovanec.bubbles.Bubbles$BubblesEngine.access$0(Bubbles.java:68)
01-11 10:57:57.940: E/AndroidRuntime(1960): at com.chovanec.bubbles.Bubbles$BubblesEngine$1.run(Bubbles.java:50)
01-11 10:57:57.940: E/AndroidRuntime(1960): at android.os.Handler.handleCallback(Handler.java:615)
01-11 10:57:57.940: E/AndroidRuntime(1960): at android.os.Handler.dispatchMessage(Handler.java:92)
01-11 10:57:57.940: E/AndroidRuntime(1960): at android.os.Looper.loop(Looper.java:137)
01-11 10:57:57.940: E/AndroidRuntime(1960): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-11 10:57:57.940: E/AndroidRuntime(1960): at java.lang.reflect.Method.invokeNative(Native Method)
01-11 10:57:57.940: E/AndroidRuntime(1960): at java.lang.reflect.Method.invoke(Method.java:511)
01-11 10:57:57.940: E/AndroidRuntime(1960): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-11 10:57:57.940: E/AndroidRuntime(1960): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-11 10:57:57.940: E/AndroidRuntime(1960): at dalvik.system.NativeStart.main(Native Method)
01-11 10:58:00.360: I/Process(1960): Sending signal. PID: 1960 SIG: 9
01-11 10:58:05.590: E/Trace(1994): error opening trace file: No such file or directory (2)
01-11 10:58:05.920: D/gralloc_goldfish(1994): Emulator without GPU emulation detected.
01-11 10:58:32.749: D/dalvikvm(1994): GC_CONCURRENT freed 47K, 2% free 8356K/8455K, paused 73ms+42ms, total 271ms
解决方案
Need to declare your activity in manfiest.xml
<activity
android:name=".Settings_activity"
android:configChanges="keyboardHidden|orientation"
android:exported="true" />
这篇关于点按设置时,动态壁纸崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文