0

Lvに問題があります。次のコードを使用して、ランチャー アクティビティを作成します。

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();

私のマニフェストでは、これを使用して宣言します:

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

それは機能していますが、壁紙ランチャーの設定をクリックすると、アクティビティが再び開始され、理由がわかりません。Logcatは私にこのエラーを与えます:

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

助けてくれてありがとう

これは私のマニフェストファイルです:

<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

このアクティビティ コードを変更してみてください

   <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 に答える
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 に答える