Class A
{
Class B
{
ArrayList<MultiGridImageNode> a
Bitmap b
ByteBuffer c
}
B bb;
save()
{
//Load will use Save method to fetch all stored value in file(which is correct)
}
load(B cc)
{
//this P.x and P.y . I am fetching from file one by one (while debugging i can see correct value)
Point P;
cc.a.get(i).add(P) //Still NULL POINTER EXCEPTION ERROR
}
}
答案 0 :(得分:0)
您的所有对象均未初始化。简单地声明它们不会实例化新对象。尝试这样的事情:
Class A
{
Class B
{
ArrayList<MultiGridImageNode> a = new ArrayList<MultiGridImageNode>(); // <----
Bitmap b = new Bitmap(); // <----
ByteBuffer c = new ByteBuffer(); // <----
}
B bb = new B(); // <----
save()
{
//Load will use Save method to fetch all stored value in file(which is correct)
}
load(B cc)
{
//this P.x and P.y . I am fetching from file one by one (while debugging i can see correct value)
Point P = new Point(); // <----
cc.a.get(i).add(P) //Still NULL POINTER EXCEPTION ERROR
}
}
我用// <----
标记了更改。