You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
634 B
Java

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;
}
}