我在下面的代码中哪里出错了?
public Bundle[] getBundle(Cursor c){
Bundle bundle[]=new Bundle[c.getCount()];
int i=0;
while(c.moveToNext()){
ArrayList<String> list=new ArrayList<String>();
list.add(c.getString(1));
list.add(c.getString(2));
bundle[i].putStringArrayList("" + i, list); //Line where NullPointerException occurs
i++;
}
return bundle;
}
导致logcat错误
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Bundle.putStringArrayList(java.lang.String, java.util.ArrayList)' on a null object reference