So this was from 2012.
I guess not a lot people use cocos2d-x.
Ok this how you do this on cocos2d-x.
Edit the AppActivity.java
public class AppActivity extends Cocos2dxActivity
{
private Activity activity;
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.activity = this;
showToast();
}
public void showToast()
{
activity.runOnUiThread(new Runnable()
{
@Override
public void run()
{
// TODO Auto-generated method stub
Toast.makeText(activity, "Hello :D", 10).show();
}
});
}
}
This works very nice in cocos2d-x version 3.x
I test it. Of course JNI just will call the method and this must work.