Cocos2d-x-3.3android Project access to the SDK problems encountered

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.