首页
学习
活动
专区
圈层
工具
发布

滑块
EN

Stack Overflow用户
提问于 2010-08-17 01:57:28
回答 1查看 638关注 0票数 0

我正试图将SlideLock添加到我的应用程序中,以获得我在SlideMe上安装的版本。由于某些原因,我在mainActivityInstance上遇到了一个错误,我不知道为什么。有什么不对吗?谢谢。

public void onCreate(束冰柱){super.onCreate(冰柱);setContentView(R.layout.home);

代码语言:javascript
复制
    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')
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-08-18 18:20:43

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

代码语言:javascript
复制
        new com.slideme.slidelock.License("My first license", 
                                      "4839206850342",
                                      this);

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

谢谢你,-SlideME SlideLock团队

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3498777

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档