**You can convert your bitmap to byte array and save it in realm database.**
like this :
Bitmap bmp = intent.getExtras().get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
Notice:Realm supports the following field types: boolean, byte, short, ìnt, long, float, double, String, Date and byte[]
**You can use [this][1] for realm configuration in android too.**
[1]: https://realm.io/docs/java/latest/
And you can convert **imageview** to **bitmap** by :
imageView.buildDrawingCache();
Bitmap bmap = imageView.getDrawingCache();
First, [convert bitmap to byte array][1]
Bitmap bmp = intent.getExtras().get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
Later, save byte[] into Realm
Notice: Strings and byte arrays (byte[]) cannot be larger than 16 MB (from Realm Documentation)
Field types
> Realm supports the following field types: boolean, byte, short, ìnt,
> long, float, double, String, Date and byte[]. The integer types byte,
> short, int, and long are all mapped to the same type (long actually)
> within Realm. Moreover, subclasses of RealmObject and RealmList<?
> extends RealmObject> are supported to model relationships.
[1]: https://stackoverflow.com/questions/4989182/converting-java-bitmap-to-byte-array