gpt4 book ai didi

android - 动态壁纸设置不显示

转载 作者:行者123 更新时间:2023-11-30 04:27:09 25 4
gpt4 key购买 nike

当我尝试启动我的动态壁纸的设置按钮时,我收到“动态壁纸选择器 (process.android.process.acore) 已意外停止。”我不太确定为什么。我正在使用 andengine。

这是在我的 main (ParticleWallpaperActivity.java) 中:

package com.particle.wallpaper;

import javax.microedition.khronos.opengles.GL10;

import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.options.EngineOptions;
import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.anddev.andengine.entity.particle.ParticleSystem;
import org.anddev.andengine.entity.particle.emitter.PointParticleEmitter;
import org.anddev.andengine.entity.particle.initializer.AccelerationInitializer;
import org.anddev.andengine.entity.particle.initializer.ColorInitializer;
import org.anddev.andengine.entity.particle.initializer.RotationInitializer;
import org.anddev.andengine.entity.particle.initializer.VelocityInitializer;
import org.anddev.andengine.entity.particle.modifier.AlphaModifier;
import org.anddev.andengine.entity.particle.modifier.ColorModifier;
import org.anddev.andengine.entity.particle.modifier.ExpireModifier;
import org.anddev.andengine.entity.particle.modifier.ScaleModifier;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.background.ColorBackground;
import org.anddev.andengine.entity.util.FPSLogger;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.anddev.andengine.opengl.texture.region.TextureRegion;

import android.content.SharedPreferences;


public class ParticleWallpaperActivity extends BaseLiveWallpaperService implements SharedPreferences.OnSharedPreferenceChangeListener {
// ===========================================================
// Constants
// ===========================================================

public static final String SHARED_PREFS_NAME = "preferences";

private static final int CAMERA_WIDTH = 480;
private static final int CAMERA_HEIGHT = 320;
private static final float RATE_MIN = 8;
private static final float RATE_MAX = 12;
private static final int PARTICLES_MAX = 200;

// ===========================================================
// Fields
// ===========================================================

private Camera mCamera;
private BitmapTextureAtlas mBitmapTextureAtlas;
private TextureRegion mParticleTextureRegion;

//Shared Preferences
private SharedPreferences mSharedPreferences;

.....
.....
.....

@Override
public void onSharedPreferenceChanged(SharedPreferences pSharedPrefs, String pKey)
{

}

这是我的 (Settings.java) 文件:

package com.particle.wallpaper;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;

public class Settings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener
{
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
getPreferenceManager().setSharedPreferencesName(ParticleWallpaperActivity.SHARED_PREFS_NAME);
addPreferencesFromResource(R.xml.preferences);
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

}

@Override
protected void onResume()
{
super.onResume();
}

@Override
protected void onDestroy()
{
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onDestroy();
}

@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{

}
}

(mjs.xml) 文件:

<?xml version="1.0" encoding="UTF-8"?>
<wallpaper
xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@drawable/icon"
android:description="@string/app_description"
android:settingsActivity="com.particle.wallpaper.Settings"/>

最后(preferences.xml):

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="First Category">
</PreferenceCategory>
</PreferenceScreen>

//编辑\我的 AndroidManifest.xml 文件:

   <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.particle.wallpaper"
android:versionCode="46"
android:versionName="1.4.6">

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<service
android:name="ParticleWallpaperActivity"
android:enabled="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter android:priority="1" >
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/mjs" />
</service>
<activity android:name="Settings"></activity>

</application>
<uses-sdk android:minSdkVersion="7" />
<uses-feature android:name="android.software.live_wallpaper" />


</manifest>

这是我收到错误时的 logcat:

 11-27 23:29:28.593: W/dalvikvm(572): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
11-27 23:29:28.593: E/AndroidRuntime(572): Uncaught handler: thread main exiting due to uncaught exception
11-27 23:29:28.694: E/AndroidRuntime(572): java.lang.IllegalStateException: Could not execute method of the activity
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.View$1.onClick(View.java:2031)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.View.performClick(View.java:2364)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.View.onTouchEvent(View.java:4179)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.widget.TextView.onTouchEvent(TextView.java:6541)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.View.dispatchTouchEvent(View.java:3709)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
11-27 23:29:28.694: E/AndroidRuntime(572): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow. java:1659)
11-27 23:29:28.694: E/AndroidRuntime(572): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
11-27 23:29:28.694: E/AndroidRuntime(572): at com.android.wallpaper.livepicker.LiveWallpaperPreview.dispatchTouchEvent(LiveWallpaperPrevi ew.java:199)
11-27 23:29:28.694: E/AndroidRuntime(572): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java: 1643)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.os.Looper.loop(Looper.java:123)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-27 23:29:28.694: E/AndroidRuntime(572): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 23:29:28.694: E/AndroidRuntime(572): at java.lang.reflect.Method.invoke(Method.java:521)
11-27 23:29:28.694: E/AndroidRuntime(572): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-27 23:29:28.694: E/AndroidRuntime(572): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-27 23:29:28.694: E/AndroidRuntime(572): at dalvik.system.NativeStart.main(Native Method)
11-27 23:29:28.694: E/AndroidRuntime(572): Caused by: java.lang.reflect.InvocationTargetException
11-27 23:29:28.694: E/AndroidRuntime(572): at com.android.wallpaper.livepicker.LiveWallpaperPreview.configureLiveWallpaper(LiveWallpaperP review.java:113)
11-27 23:29:28.694: E/AndroidRuntime(572): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 23:29:28.694: E/AndroidRuntime(572): at java.lang.reflect.Method.invoke(Method.java:521)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.view.View$1.onClick(View.java:2026)
11-27 23:29:28.694: E/AndroidRuntime(572): ... 20 more
11-27 23:29:28.694: E/AndroidRuntime(572): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.particle.wallpaper/.Settings (has extras) } from ProcessRecord{43db8760 572:android.process.acore/10022} (pid=572, uid=10022) requires null
11-27 23:29:28.694: E/AndroidRuntime(572): at android.os.Parcel.readException(Parcel.java:1218)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.os.Parcel.readException(Parcel.java:1206)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1214)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.app.Activity.startActivityForResult(Activity.java:2749)
11-27 23:29:28.694: E/AndroidRuntime(572): at android.app.Activity.startActivity(Activity.java:2855)
11-27 23:29:28.694: E/AndroidRuntime(572): ... 24 more


There must be something very simple that I'm missing, but I just can't seem to figure it out. Any help would be greatly appreciated.

最佳答案

我已经解决了这个问题。看来我必须从以下位置更改我的 AndroidManifest.xml:

<activity android:name="Settings"></activity>

到:

<activity android:name="Settings">
<intent-filter>
<action android:name="android.intent.action.MAIN">
</action>
</intent-filter>
</activity>

Logcat 创造奇迹:)

关于android - 动态壁纸设置不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8289988/

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