package com.xypower.mpremote.utils; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; public class ImageUtils { public static Drawable loadDrawable(String file) { if (file == null || file.isEmpty()) { return null; } Drawable drawable = null; try { Bitmap bitmap = BitmapFactory.decodeFile(file); drawable = new BitmapDrawable(bitmap); } catch (Exception e) { e.printStackTrace(); } return drawable; } }