+ Reply to Thread
Results 1 to 2 of 2

Thread: Encode/Decode text in and to base64

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    9

    Encode/Decode text in and to base64

    Hello , i`d like to know how can i Encode/Decode text in base64 in android ?

  2. #2
    TO encode data to Base64
    Code:
    byte[] data = text.getBytes("UTF-8");
    String base64 = Base64.encodeToString(data, Base64.DEFAULT);
    To decode the base64
    Code:
    byte[] data = Base64.decode(base64, Base64.DEFAULT);
    String text = new String(data, "UTF-8");

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts