[Solved] Toast message crash app


Solved by using this method:

 private static MainActivity instance;

    public MainActivity() {
        instance = this;
    }

and changing the showtoast script to:

Toast.makeText(instance, toast, Toast.LENGTH_SHORT).show();

solved Toast message crash app