アセットから壁紙を設定しようとすると、作業が完了するまでに時間がかかるため、ハードコードの代わりにもっと簡単な方法があるかもしれません
public void Setwallpaper(int position , Context context) throws IOException{
AssetManager am = mContext.getAssets();
nlist = am.list("Gallary");
BufferedInputStream buf = new BufferedInputStream(am.open(nlist[position]));
bitmap = BitmapFactory.decodeStream(buf);
buf.close();
WallpaperManager myWallpaperManager = WallpaperManager
.getInstance(context);
try {
myWallpaperManager.setBitmap(bitmap);
Toast.makeText(context, "Wallpaper set",
0).show();
} catch (IOException e) {
Toast.makeText(context,
"Error setting wallpaper", Toast.LENGTH_SHORT)
.show();
}
}
他のアプリケーションが1秒未満でそれを行うことができたのを見た間、それを行うには約3秒かかりますどんな提案でも私はそれを感謝します