简体   繁体   中英

android usage of “controller.query(activity);” in scoreloop

i am attempting to implement a built in controller that is part of the scoreloop library. the documentation states:

Basic Usage:

To invoke the TOS dialog if it was not accepted previously, the following code may be used:

 final TermsOfServiceController controller = new TermsOfServiceController(new TermsOfServiceControllerObserver() {
 @Override
 public void termsOfServiceControllerDidFinish(final TermsOfServiceController controller, final Boolean accepted) {
    if(accepted != null) {
        // we have conclusive result.
        if(accepted) {
            // user did accept
        }
        else {
            // user did reject
        }
    }
 }
 });
 controller.query(activity);

but when i paste this into my code i get the following syntax errors:

令牌语法错误,构造放置错误令牌“活动”的语法错误,此令牌后应为VariableDeclaratorId

am i using this incorrectly? how and where would this be used any ideas?

EDIT: after moving the statement to the method where i want to show the dialog i now get the following error:

新错误

You seem to be calling controller.query(activity) in a class body where a declaration is expected. Move the statement controller.query(activity) to a method where you would like to show the dialog.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM