Hey, I've been testing around with GUIs, and I tried making a button with a image, but it keep getting the error
can't find methode android.widget.ImageView.setImageBitmap(android.graphic.drawable.BitmapDrawable), if any of u guys out there can help me fix it, leave a comment below thx!
CODE:
function newLevel()
{
var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
ctx.runOnUiThread(new java.lang.Runnable(
{
run: function()
{ try
{
var layout = new android.widget.LinearLayout(ctx);
layout.setOrientation(1);
var directory = new android.graphics.BitmapFactory.decodeFile("download/button.png");
var img = new android.graphics.drawable.BitmapDrawable(directory);
var image = new android.widget.ImageView(ctx);
image.setImageBitmap(img);
image.setOnClickListener(new android.view.View.OnClickListener(
{
onClick: function(viewarg){
mainMenu();
} }));
layout.addView(menuBtn);
GUI = new android.widget.PopupWindow(layout,android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
GUI.setBackgroundDrawable(newandroid.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
GUI.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
}
catch(err){ print("An error occured: " + err);
} }})); }
can't find methode android.widget.ImageView.setImageBitmap(android.graphic.drawable.BitmapDrawable), if any of u guys out there can help me fix it, leave a comment below thx!
CODE: