开发者

How to put a wallpaper inside an apk file?

开发者 https://www.devze.com 2023-01-16 10:26 出处:网络
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? ;)\")

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号