繁体   English   中英

Android:java.lang.NullPointerException

[英]Android: java.lang.NullPointerException

我目前与buzztouch android应用有问题,我是从Google Play创建的错误是

NullPointerException
in BT_viewUtilities.updateBackgroundColorsForScreen()

我将其范围缩小到以下代码,有人在代码中看到任何错误吗? 如果您还需要其他东西,请询问,这将修复很多应用程序。 谢谢

//updates a screens background colors and image...
public static void updateBackgroundColorsForScreen(final Activity theActivity, final          BT_item theScreenData){
BT_debugger.showIt(objectName + ":updateBackgroundColorsForScreen with nickname: \"" +     theScreenData.getItemNickname() + "\""); 

ScreenData或BT_debugger为null。

我不知道您的代码在做什么,但解决方法很简单:

//updates a screens background colors and image...
public static void updateBackgroundColorsForScreen(final Activity theActivity, final BT_item theScreenData){
     if(BT_debugger != null && theScreenData != null){
          BT_debugger.showIt(objectName + ":updateBackgroundColorsForScreen with nickname: \"" +     theScreenData.getItemNickname() + "\""); 
     } else {
         Log.e("YourApp", "Warning null var, command not completed");
     }
}

要调试错误,您可以执行以下操作:

    //updates a screens background colors and image...
    public static void updateBackgroundColorsForScreen(final Activity theActivity, final BT_item theScreenData){
         if(BT_debugger != null){
             if(theScreenData != null){
                BT_debugger.showIt(objectName + ":updateBackgroundColorsForScreen with nickname: \"" +     theScreenData.getItemNickname() + "\""); 
             } else {
                Log.e("YourApp", "theScreenData was null, command not completed");
             }
         } else {
             Log.e("YourApp", "BT_debugger was null, command not completed");
         }
    }

我认为这是导致空点异常的行-The ScreenData.getItemNickname()

暂无
暂无

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

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