0

I have problem with my Lv. I create launcher activity to it, using this code:

Toast toast = Toast.makeText(this, "Choose Photo Live Wallpaper from the list to start the Live Wallpaper.",Toast.LENGTH_LONG); toast.show(); Intent intent = new Intent(); intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER); startActivity(intent); finish();

in my manifest I declare it using this:

<activity android:name=".Launcher" android:label="@string/app_name"
    android:screenOrientation="portrait" 
    android:icon="@drawable/iconn">
    <intent-filter>
         <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
          <action android:name="android.intent.action.CREATE_SHORTCUT" />
    </intent-filter>
</activity>

and it is working but when i click on set wallpaper launcher activity is starting again and i dont know why. Logcat give me this error:

chanel '4143dd60 org.me.project.serviceLv (client) ~ Publisher close input chanell or an error ocured event=0x8

Thanks for any help

This is my manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.gp.project.photogallerylivewallpaper"
android:versionCode="2"
android:versionName="1.1" >

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

<uses-feature android:name="android.software.live_wallpaper" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application>
    <service
        android:name=".GalleryWallpaper2"
        android:label="Photo LiveWallpaper"
        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/wallpaper" />
    </service>

    <activity
        android:name=".Settings"
        android:exported="true"
        android:launchMode="singleTask"
        android:theme="@android:style/Theme.Light.NoTitleBar" />
    <activity
        android:name=".Launcher"
        android:icon="@drawable/iconn"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

            <action android:name="android.intent.action.CREATE_SHORTCUT" />
        </intent-filter>
    </activity>
</application>

4

2 回答 2

0

发布更多你的 logcat。同样对于动态壁纸,您需要在您的 Android 清单中定义一个服务,其中包含一个意图过滤器。前任 :-

      <service android:name="packagename.LiveWallpaper" //LiveWallpaper is the class  name
        android:label="@string/app_name"
        android:icon="@drawable/icon"
        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/livewallpaper" />    
    </service>
于 2013-07-04T16:34:45.807 回答
0

尝试更改您的此活动代码

   <activity
    android:name=".Settings"
    android:exported="true"
    android:launchMode="singleTask"
    android:theme="@android:style/Theme.Light.NoTitleBar" />

有了这个......

   <activity
    android:name=".Settings"
    android:exported="true"
    android:launchMode="singleTask"
    android:theme="@android:style/Theme.NoDisplay" />

我认为这真的会奏效....

于 2014-03-08T08:44:44.130 回答