CopyPastor

Detecting plagiarism made easy.

Score: 1.73872971534729; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2019-01-24
by milad salimi

Original Post

Original - Posted on 2016-03-17
by toantran



            
Present in both answers; Present only in the new answer; Present only in the old answer;

**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

        
Present in both answers; Present only in the new answer; Present only in the old answer;