How to put a wallpaper inside an apk file?
I'm planning to release a nice clock widget and I'd like to include a pretty wallpaper with it (want to do this because previously got some comments like "can i get the matching wallpaper? ;)")
So I tried to google on how to put some image file inside apk so that it would appear in wallpapers selection list after installa开发者_如何学编程tion. I mean the list which appears when doing Home=>Menu=>Wallpaper=>Wallpaper Gallery or Pictures - whatever.
So far didn't find any hints, so decided to try to ask here.
Any hints on how to do that?
You could package the wallpaper in res/raw, and then when your app fires up for the first time, attempt to copy it to the sdcard directory /media/pictures.
You should be using methods such as getExternalStorageDirectory or getExternalStoragePublicDirectory (depending on the API level) to open the file.
http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
精彩评论