gpt4 book ai didi

java - 点击“设置”时动态壁纸崩溃

转载 作者:行者123 更新时间:2023-12-02 07:20:52 25 4
gpt4 key购买 nike

总是当我点击动态壁纸选择器中的设置...按钮时,它就会停止。然后也停止我的动态壁纸。

enter image description here

你能帮我吗?

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这是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

最佳答案

需要在 manfiest.xml 中声明您的 Activity

    <activity
android:name=".Settings_activity"
android:configChanges="keyboardHidden|orientation"
android:exported="true" />

关于java - 点击“设置”时动态壁纸崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14276583/

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