Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static String bitmapToString(Bitmap bitmap) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
- byte[] b = baos.toByteArray();
- return Base64.encodeToString(b, Base64.DEFAULT);
- }
- private static Bitmap stringToBitmap(String encodedString) {
- try {
- byte[] encodeByte = Base64.decode(encodedString, Base64.DEFAULT);
- return BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
- } catch (Exception e) {
- e.getMessage();
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement