خرید بک لینک

Vote count: 0

I have been scripting Minecraft PE with Rhino, I have been existing libraries from both Java and android and I thought to myself why not make my own classes and script those now I made a android class...

Android class

package com.latch.to.modpe;
public class MainActivity extends android.app.Activity 
{
    private android.widget.Toast t;
    public void printToast()
    {
        t = new android.widget.Toast(getApplicationContext());
        t.makeText(getApplicationContext(), "Hello Minecraft from my java file", android.widget.Toast.LENGTH_LONG);
    }
}

And my JS File

var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
var myClassFromFile = com.latch.to.modpe
function newLevel()
{
    ctx.runOnUiThread(new java.lang.Ruable() {
        run: function()
        {
            try
            {
                myClassFromFile.printToast();
            }
            catch(error)
            {
                clientMessage(error);
            }
        }
    });
}

But when I ran it it gave me the error

Caot call property printToast in object [JavaPackage com.latch.to.modpe]. It is not a function it is an object. 

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 14 خرداد 1395 ساعت: 21:39

صفحه بندی