Advertisement
peacestorm

Base64 ModPE

Jun 25th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. var path = android.os.Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/com.mojang/minecraftpe/mods";
  2. var imageIcon = " /*Base64 code here*/ ";
  3. Base64Decode(android.util.Base64.decode(imageIcon, 0), path + "/imagename.png");
  4.  
  5. function Base64Decode(byteArray, Path) {
  6. try {
  7. var File = new java.io.File(Path);
  8. if (!File.exists()) {
  9. File.createNewFile();
  10. var Stream = new java.io.FileOutputStream(File);
  11. Stream.write(byteArray);
  12. Stream.close();
  13. }
  14.  
  15. } catch (err) {
  16. print(err);
  17. }
  18. }
  19.  
  20. var imageBtn = new android.graphics.BitmapFactory.decodeFile(android.os.Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/com.mojang/minecraftpe/mods/imagename.png");
  21.  
  22. var imageButton = new android.graphics.drawable.BitmapDrawable(imageBtn);
  23.  
  24. //Now use button.setBackgroundDrawable(imageButton);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement