Does anyone know how to decode and encode a string in Base64 using Base64?

Issue I am using the following code, but it’s not working. String source = "password"; byte[] byteArray = source.getBytes("UTF-16"); Base64 bs = new Base64(); //bs.encodeBytes(byteArray); System.out.println(bs.encodeBytes(byteArray)); //bs.decode(bs.encodeBytes(byteArray)); System.out.println(bs.decode(bs.encodeBytes(byteArray))); Solution First: Choose an encoding. UTF-8 is generally a good choice; stick

Continue reading

Play audio using base64 data in html5

Issue I have created one application to record audio using native mediaPlayer, converting this audio file into base64 data, passing this in html5 audio tag as below, File file = new File(Environment.getExternalStorageDirectory()+”/”+ “audiofile”+”/”+”myAudio.mp3”); byte[] FileBytes =getBytesFromFile(file); String base64 = Base64.encodeToString(FileBytes,

Continue reading