0

I developed the bubble-dictionary live wallpaper and is working fine, but when I change orientation on my mobile android canvas, it give error illegal argument exception, so I want to have fixed orientation of my wallpaper service. Any one can please help me how to fixed the orientation of live wallpaper service my Manifest file have follwoing its not have any screen orientation for service tag so please tell me how to do this

<application
    android:icon="@drawable/icon"
    android:label="@string/app_name" >
    <service
        android:name="com.packageService.android.samplesV1.SampleLiveWallpaperService"
        android:label="@string/liveWallpaper"
        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/sample_livewallpaper" />
    </service>

    <activity
        android:name="com.packageService.android.samplesV1.ColorSettings"
        android:exported="true"
        android:label="Settings"
        android:screenOrientation="portrait" >
    </activity>
</application>
Nirav Mehta
  • 1,715
  • 4
  • 23
  • 42
  • i dont want to change orientation , i want to fixed orientation of potrait of my livewallpapaer service, but through my try it not possible with service so how to do fixed orientation of portrait of service ? – Nirav Mehta Feb 15 '14 at 12:23

1 Answers1

0

I dont find solution for screen orientation change of service but if we want to remove exception illegal argument exception do follwoing in finally block ( simply holder.unlockCanvasAndPost(canvas); put in try and catch block )

finally {
    if (canvas != null) {
        try {
            holder.unlockCanvasAndPost(canvas);
            } 
                            catch (Exception e) {
            e.printStackTrace();
        }
    }
}
CSchulz
  • 10,882
  • 11
  • 60
  • 114