The topic is about Bitmaps and how to efficiently load them into your device's memory and, if needed, set them as a wallpaper.
The code is aimed at Android and written in Java and you need API level 14 (ICS) or higher. Perhaps with some tweaking it might work for other Java-based platforms and Android versions. But that is up to you.
Some requirements I had while making this code:
- A Bitmap of any size should be loadable on any device, both low-end as high-end.
- Make as less Bitmaps in memory as possible.
- Free Bitmaps in memory as soon it is possible.
- Always check if Bitmaps, and other variables, actually exists in memory before processing.
- Android Developer Bitmap: https://developer.android.com/reference/android/graphics/Bitmap.html
- Android Developer BitmapFactory: https://developer.android.com/reference/android/graphics/BitmapFactory.html
- Android Developer WallpaperManager: https://developer.android.com/reference/android/app/WallpaperManager.html
Copyright (c) 2015 Joram Teusink
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.