I just want to store a Drawable image file in Realm database, but after assigning the value in Realm Object, it's showing one error message that "error: Type android.graphics.drawable.Drawable of field is not supported".
public class AppsList extends RealmObject {
public Drawable getAppIcon() {
return appIcon;
}
public void setAppIcon(Drawable appIcon) {
this.appIcon = appIcon;
}
}
Intent i = new Intent(Intent.ACTION_MAIN, null);
i.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> availableActivities = manager.queryIntentActivities(
i, 0);
for (ResolveInfo ri : availableActivities) {
realm.beginTransaction();
appsIconList = realm.createObject(AppsList.class);
appsIconList.setAppLabel(ri.loadLabel(manager).toString());
appsIconList.setAppPackageName(ri.activityInfo.packageName.toString());
appsIconList.setAppIcon(ri.activityInfo.loadIcon(manager).toString());
realm.commitTransaction();
}
Please kindly go through my post and let me that how to store drawable file in Realm Database.