简体   繁体   English

具有SherlockFragmentActivity的EasyTracker

[英]EasyTracker with SherlockFragmentActivity

I am having a hard time using Google Analytics EasyTracker in my Activities that extend SherlockFragmentActivity. 我在扩展SherlockFragmentActivity的活动中使用Google Analytics EasyTracker遇到了困难。 When I try to use EasyTracker.getInstance().activityStart(this); 当我尝试使用EasyTracker.getInstance().activityStart(this); in onStart, the compiler doesn't complain but the app crashes with: 在onStart中,编译器不会抱怨,但是应用程序崩溃:

android.content.res.Resources$NotFoundException: String resource ID #0x7f0a0001 android.content.res.Resources $ NotFoundException:字符串资源ID#0x7f0a0001

If I try to do EasyTracker.getInstance().setContext(this); 如果我尝试做EasyTracker.getInstance().setContext(this); in any method outside of onStart, I get the same exception. 在onStart之外的任何方法中,我都会遇到相同的异常。

I am having a hard time understanding what's going on here, or whether it is possible at all to use EasyTracker with FragmentActivities. 我很难理解这里发生了什么,或者是否有可能将EasyTracker与FragmentActivities一起使用。

Thanks, Igor 谢谢,伊戈尔

EasyTracker have the following method. EasyTracker具有以下方法。

EasyTracker.getInstance().setContext(this);

and the tutorial explained how to start: 本教程说明了如何开始:

public void onStart() {
    super.onStart();
    ... // The rest of your onStart() code.
    EasyTracker.getInstance().activityStart(this); // Add this method.
  }

According to https://developers.google.com/analytics/devguides/collection/android/v2/ 根据https://developers.google.com/analytics/devguides/collection/android/v2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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