Advertisement
peacestorm

Background for menu

Jun 29th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 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 imageBckgrnd = new android.graphics.BitmapFactory.decodeFile(android.os.Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/com.mojang/minecraftpe/mods/imagename.png");
  21.  
  22. var imageBackground = new android.graphics.drawable.BitmapDrawable(imageBckgrnd);
  23.  
  24. //Now use menu.setBackgroundDrawable(imageBackground);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement