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
}
}
问问题
59 次
1 回答
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
}
}
我用 标记了更改// <----
。
于 2013-02-04T12:11:01.350 回答