Android Tutorial Android Live Wallpaper tutorial

Douglas Farias

Expert
Licensed User
Longtime User
hi @Erel
i have try your sample, but dont work on my moto g, i dont make any change, i open the app , select one image on galery and later i see a toast image set, but dont work dont put my image at background *-*
LiveWallpaperImage.zip
 

Troberg

Well-Known Member
Licensed User
Longtime User
Is it possible to get antialiasing? I have a LWP which draws some curves, and the lines really look jagged.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
B4X:
Sub ActivateAA(BG As Canvas, AAstate As Boolean ) As Boolean 
	Dim Obj1 As Reflector
	If AntiAliasing Then 
		'Try
			Obj1.Target = BG
			Obj1.Target = Obj1.GetField("paint")
			Obj1.RunMethod2("setAntiAlias", AAstate, "java.lang.boolean")
			Return AAstate
		'Catch
		'End Try
	End If
End Sub
[/code[
 

Troberg

Well-Known Member
Licensed User
Longtime User
I've already tried that, and, while it runs without errors, it doesn't give me any antialiasing either.

It doesn't matter which lwm engine event I run it in, no result whatsoever.
 

koaunglay

Member
Licensed User
Longtime User
Hi! All friends! I'm trying with three module(Main, userP, WallpaperService).
This is my code from wallpaper.xml
-----------------
B4X:
<?xml version="1.0" encoding="utf-8"?>
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
  android:thumbnail="@drawable/icon" 
  android:settingsActivity="com.aunglw2.userP"
/>
---------------------------
This is my code from manifest editor
-------------------------------------
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.
AddApplicationText(
<service
android:label="HI!"
android:name="anywheresoftware.b4a.objects.WallpaperInternalService"
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/wallpaper"/>
</service>
)
SetActivityAttribute(userP,android:exported, true)
But when I click settings.. button in preview, my app is not work. It show " Unfortunately, Live Wallpaper Picker has stopped."
How should I do? Help some body! Thanks all....
 

koaunglay

Member
Licensed User
Longtime User
This is from my log. I think no error. I don't know...
=============
** Service (wallpaperservice) Create **


** Service (wallpaperservice) Start **


** Activity (main) Create, isFirst = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (userp) Create, isFirst = true **


Downsampling image due to lack of memory.


Downsampling image due to lack of memory.


** Activity (userp) Resume **


Downsampling image due to lack of memory.


** Activity (userp) Pause, UserClosed = true **

===============Help me please................
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…