我是Android编码新手。我想创建一个动态壁纸,但我确实希望在移动设备上创建一个相同的图标,以便它也从那里启动。我假设我的代码中存在一些问题。 请做好。
清单在
之下 <manifest package="com.appsultra12Shiva"
android:versionCode="1"
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk
android:minSdkVersion="8" android:targetSdkVersion="17"/>
<uses-feature android:name="android.software.live_wallpaper" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<!-- <uses-permission android:name="android.permission.BIND_WALLPAPER" /> -->
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true" />
<application
android:label="@string/app_name"
android:icon="@drawable/ic_launcher">
<service
android:label="@string/app_name"
android:name=".MyWallpaperService"
android:enabled="true"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter android:priority="1">
<action
android:name="android.service.wallpaper.WallpaperService">
</action>
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/wallpaper" >
</meta-data>
</service>
<activity
android:name=".SetWallpaperActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.WallpaperSettings"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.PREFERENCE" />
</intent-filter>
</activity>
</application>
</manifest>
活动Java代码在
之下 public class SetWallpaperActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onRestart() {
super.onRestart();
}
public void onStart() {
super.onStart();
}
public void onResume() {
super.onResume();
}
public void onPause() {
super.onPause();
}
public void onStop() {
super.onStop();
}
public void onDestroy() {
super.onDestroy();
}
}
请同时查找日志:
04-21 20:46:02.541: E/Zygote(33): setreuid() failed. errno: 2
04-21 20:46:34.212: E/Zygote(33): setreuid() failed. errno: 17
04-21 20:46:40.502: E/BatteryService(73): usbOnlinePath not found
04-21 20:46:40.502: E/BatteryService(73): batteryVoltagePath not found
04-21 20:46:40.522: E/BatteryService(73): batteryTemperaturePath not found
04-21 20:46:40.692: E/SurfaceFlinger(73): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
04-21 20:50:59.482: E/EventHub(73): could not get driver version for /dev/input/mouse0, Not a typewriter
04-21 20:50:59.512: E/EventHub(73): could not get driver version for /dev/input/mice, Not a typewriter
04-21 20:51:00.812: E/System(73): Failure starting core service
04-21 20:51:00.812: E/System(73): java.lang.SecurityException
04-21 20:51:00.812: E/System(73): at android.os.BinderProxy.transact(Native Method)
04-21 20:51:00.812: E/System(73): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-21 20:51:00.812: E/System(73): at android.os.ServiceManager.addService(ServiceManager.java:72)
04-21 20:51:00.812: E/System(73): at com.android.server.ServerThread.run(SystemServer.java:184)
04-21 20:51:05.652: E/SoundPool(73): error loading /system/media/audio/ui/Effect_Tick.ogg
04-21 20:51:05.763: E/SoundPool(73): error loading /system/media/audio/ui/KeypressStandard.ogg
04-21 20:51:05.962: E/SoundPool(73): error loading /system/media/audio/ui/KeypressSpacebar.ogg
04-21 20:51:06.041: E/SoundPool(73): error loading /system/media/audio/ui/KeypressDelete.ogg
04-21 20:51:06.072: E/SoundPool(73): error loading /system/media/audio/ui/KeypressReturn.ogg
04-21 20:51:43.293: E/ThrottleService(73): Error reading data file
04-21 20:51:43.493: E/ThrottleService(73): Could not open GPS configuration file /etc/gps.conf
04-21 20:51:44.862: E/logwrapper(148): executing /system/bin/tc failed: No such file or directory
04-21 20:51:45.922: E/logwrapper(156): executing /system/bin/tc failed: No such file or directory
04-21 20:51:46.591: E/logwrapper(157): executing /system/bin/tc failed: No such file or directory
04-21 20:52:27.392: E/logwrapper(183): executing /system/bin/tc failed: No such file or directory
04-21 20:52:27.621: E/logwrapper(184): executing /system/bin/tc failed: No such file or directory
04-21 20:52:27.773: E/logwrapper(185): executing /system/bin/tc failed: No such file or directory
04-22 02:23:13.489: E/ThrottleService(73): Error reading data file
04-22 02:23:33.774: E/HierarchicalStateMachine(73): TetherMaster - unhandledMessage: msg.what=3
04-22 02:23:33.810: E/HierarchicalStateMachine(73): TetherMaster - unhandledMessage: msg.what=3
04-22 02:24:12.449: E/ActivityManager(73): ANR in com.android.mms
04-22 02:24:12.449: E/ActivityManager(73): Reason: Broadcast of Intent { act=android.intent.action.BOOT_COMPLETED cmp=com.android.mms/.transaction.MmsSystemEventReceiver }
04-22 02:24:12.449: E/ActivityManager(73): Load: 7.18 / 3.55 / 1.57
04-22 02:24:12.449: E/ActivityManager(73): CPU usage from 23365ms to 298ms ago:
04-22 02:24:12.449: E/ActivityManager(73): re-initialized>: 24% = 21% user + 2% kernel / faults: 844 minor 3 major
04-22 02:24:12.449: E/ActivityManager(73): system_server: 12% = 7% user + 5% kernel / faults: 966 minor 8 major
04-22 02:24:12.449: E/ActivityManager(73): d.process.media: 10% = 6% user + 4% kernel / faults: 3343 minor
04-22 02:24:12.449: E/ActivityManager(73): ndroid.launcher: 3% = 3% user + 0% kernel / faults: 599 minor 8 major
04-22 02:24:12.449: E/ActivityManager(73): fsck_msdos: 2% = 1% user + 1% kernel / faults: 514 minor
04-22 02:24:12.449: E/ActivityManager(73): m.android.phone: 1% = 0% user + 0% kernel / faults: 245 minor
04-22 02:24:12.449: E/ActivityManager(73): kswapd0: 0% = 0% user + 0% kernel
04-22 02:24:12.449: E/ActivityManager(73): ronsoft.openwnn: 0% = 0% user + 0% kernel / faults: 268 minor
04-22 02:24:12.449: E/ActivityManager(73): adbd: 0% = 0% user + 0% kernel
04-22 02:24:12.449: E/ActivityManager(73): id.defcontainer: 0% = 0% user + 0% kernel / faults: 119 minor
04-22 02:24:12.449: E/ActivityManager(73): logcat: 0% = 0% user + 0% kernel / faults: 18 minor
04-22 02:24:12.449: E/ActivityManager(73): zygote: 0% = 0% user + 0% kernel / faults: 34 minor
04-22 02:24:12.449: E/ActivityManager(73): pdflush: 0% = 0% user + 0% kernel
04-22 02:24:12.449: E/ActivityManager(73): roid.alarmclock: 0% = 0% user + 0% kernel / faults: 17 minor
04-22 02:24:12.449: E/ActivityManager(73): rild: 0% = 0% user + 0% kernel / faults: 29 minor
04-22 02:24:12.449: E/ActivityManager(73): qemud: 0% = 0% user + 0% kernel / faults: 5 minor
04-22 02:24:12.449: E/ActivityManager(73): installd: 0% = 0% user + 0% kernel / faults: 13 minor
04-22 02:24:12.449: E/ActivityManager(73): +com.android.mms: 0% = 0% user + 0% kernel
04-22 02:24:12.449: E/ActivityManager(73): TOTAL: 100% = 75% user + 24% kernel + 0% irq + 0% softirq
: E/(): Device disconnected