/** * 更新相冊某個文件 */
public static void photoUpdates(Context context, File file) { if (!file.exists()) { return; } try { MediaStore.Images.Media.insertImage(context.getContentResolver(), file.getAbsolutePath(), file.getName(), null); } catch (FileNotFoundException e) { e.printStackTrace(); } Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(file)); context.sendBroadcast(intent); }
/**獲取view 緩存(例如屏幕截屏,root layout )*/
public static Bitmap getViewCacheBitMap(View view) { view.setDrawingCacheEnabled(true); view.buildDrawingCache(); Bitmap bitmap = view.getDrawingCache(); return bitmap; }