Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检查Java Android中的VectorObject是否为空或Null_Java_Android_Object_Vector_Nullpointerexception - Fatal编程技术网

检查Java Android中的VectorObject是否为空或Null

检查Java Android中的VectorObject是否为空或Null,java,android,object,vector,nullpointerexception,Java,Android,Object,Vector,Nullpointerexception,我想检查矢量对象在ANDROID中是否为空或Null if(vectorCustRecipetDB != null && vectorCustRecipetDB.size() != 0) { for (int i = 0; i < vectorCustRecipetDB.size(); i++) { Some Code } } if(vectorCustRecipetDB!=null&&vectorCustRecipe

我想检查矢量对象在ANDROID中是否为空或Null

if(vectorCustRecipetDB != null && vectorCustRecipetDB.size() != 0)
    {
        for (int i = 0; i < vectorCustRecipetDB.size(); i++) {
        Some Code
     }
  }
if(vectorCustRecipetDB!=null&&vectorCustRecipetDB.size()!=0)
{
对于(int i=0;i

但我得到了空指针异常。请帮助。

堆栈跟踪在哪里??或
logcat
?这些行不会导致NPE。发布异常和包含违规行的代码。使用您提供的代码不可能。好的,我知道了。问题出在这行txtCustRecCardRouteNo.setText(vectorCustRecipetDB.get(i).route_No);我得到的路径号为null。实际上问题是我在初始化txtCustRecCardRouteNo之前设置了文本。这就是为什么我会犯这个错误。Thnx@ZouZou问题解决了。