The new cocos2d-x-3.3 version of Android project, when access to the paid SDK, want to let the game start when the implementation of the SDK initialization, unfortunately open the main Appactivity.java, did not provide a method.
Workaround:
You can override the Init () method of the parent class cocos2dxactivity, such as:
public void init () {
Super.init ();
Here's how to do it when the game starts
}
Next you want to pay the time in the static method called Toast, error ...
Workaround:
Initializes a handler object in the Init () method of the main activity, such as:
public static Android.os.Handler Dialoghandler = null;
public static appactivity activity;
public void Init ()
{
Super.init ();
Dialoghandler = new Android.os.Handler ();
activity = this;
}
public static void Showtoastdialog (final String text)
{
Dialoghandler.post (New Runnable () {
public void Run () {
TODO auto-generated Method Stub
Toast.maketext (activity, text, Toast.length_short). Show ();
}
});
}
Then call Appactivity.showtoastdialog ("toast display") somewhere else, and solve the problem.
Then there is a problem: when the payment is successful, call the static method to return to the game to pay the results, the status of the card is dead ...
Workaround:
public static void Payfinish () {
Cocos2dxglsurfaceview.getinstance (). Queueevent (New Runnable () {
public void Run () {
Here call the static method of the incoming game payment result
}
});
}
Cocos2d-x-3.3android Project access to the SDK problems encountered