0

我正在尝试将 SlideLock 添加到我的应用程序中,以获取我正在放置在 SlideMe 上的版本。出于某种原因,我在 mainActivityInstance 收到错误,我不知道为什么。有什么想法有什么问题吗?谢谢。

public void onCreate(Bundle icicle) { super.onCreate(icicle); 设置内容视图(R.layout.home);

    com.slideme.slidelock.License myLicense = 
        new com.slideme.slidelock.License("My first license", 
                                          "4839206850342",
                                          mainActivityInstance);
    // There are other constructors available also. 
    // This one is just the most comfortable.

    try{
        /* 
        *  You can store the fetched data in a persistent storage and retrieve 
        *  it from there on the next application startup, just in case you 
        *  want to save the end-user's networking traffic and reduce startup 
        *  delays. We strongly recommend you to refresh the license from 
        *  time to time, just in case the end-user claims a refund, or any 
        *  other corner case scenario
        */
        myLicense.digest(myLicense.fetch());
    } catch(IOException ioe){
        // license couldn't initialize. Handle this
    }

    Rights someRights = myLicense.getFullRights();
    // Works even if you already reserved the SlideLock Key in the past.

    if(someRights != null){
        // you have granted rights.
    } else {
        // You don't have any rights for the feature in cause. Try
        // some features. (Currently not supporting multiple 'features')
    }
4

1 回答 1

0

我没有看到您在任何地方声明 mainActivityInstance 变量。如果您在 Activity#onCreate(Bundle icicle) 方法中使用此代码,则可以尝试通过直接传递 Activity 实例引用来实例化 SlideLock2:

        new com.slideme.slidelock.License("My first license", 
                                      "4839206850342",
                                      this);

如果您有进一步的麻烦,请告诉我。

谢谢,-SlideME SlideLock 团队

于 2010-08-18T18:20:43.020 回答