This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setPaperWell.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
WallpaperManager wallpaperManager = WallpaperManager.getInstance(getActivity().getApplicationContext()); | |
//imageView 轉 Bitmap | |
//ImageView iv = (ImageView) getActivity().findViewById(R.id.imageView); | |
try { | |
//wallpaperManager.setBitmap(iv.getDrawingCache()); | |
wallpaperManager.setResource(select); | |
Toast.makeText(getActivity(), "桌布設定成功!", Toast.LENGTH_SHORT).show(); | |
} | |
catch(IOException e) | |
{ | |
e.printStackTrace(); | |
Toast.makeText(getActivity(), "Wallpaper error!", Toast.LENGTH_SHORT).show(); | |
} | |
} | |
}); |
按下設成桌布就完成了... 儲存圖片的功能+設定桌布完整版的CODE
沒有留言:
張貼留言