1

I want the user to be able to tap on my livewallpaper to select an image from gallery. Is it possible to do this? To make this question more generic, how can we perform a startActivityForResult from a live wallpaper service?

I have gone through this thread - Android liveWallpaper background where startActivity is implemented. I'm specifically looking for a callback from startActivityForResult.

Thanks

Community
  • 1
  • 1
Mahadevan Sreenivasan
  • 1,144
  • 1
  • 9
  • 26
  • You should look at this answer: http://stackoverflow.com/questions/3679330/choosing-background-for-live-wallpaper – Jave Dec 07 '11 at 09:00
  • I know it's possible to do this by implementing the image picker through a settings activity. I want the user to be able to pick an image by tapping on my live wallpaper. – Mahadevan Sreenivasan Dec 07 '11 at 09:03
  • I see. I am unsure about how to do that. Just a personal opinion: I would find it slightly annoying if I kept being asked for input every time I tapped my desktop. – Jave Dec 07 '11 at 09:13

1 Answers1

2

It is impossible to call startActivityForResult from any Service (including WallpaperService). What you can do as a workaround is to create a transparent Activity:

android:theme="@android:style/Theme.Translucent.NoTitleBar"  

and invoke it from your LiveWallpaperService using startActivity (don't forget to set the FLAG_ACTIVITY_NEW_TASK). Then you can use the startActivityForResult for doing your stuff and when managing the result you just have to finish() the transparent Activity.

Rodrigo Dias
  • 412
  • 4
  • 13