关于DatabaseHelper extends SQLiteOpenHelper的操作,
@Override
public void close() {
if (this != null) {
this.close();
} }程序运行时正常,退出程序时this.close(); 这句话报错java.lang.StackOverflowError
本人菜鸟,谢谢了。
@Override
public void close() {
if (this != null) {
this.close();
} }程序运行时正常,退出程序时this.close(); 这句话报错java.lang.StackOverflowError
本人菜鸟,谢谢了。
if (this != null) { //2
this.close(); //3
} }2一直为真,进入3,3调用close方法,回到1,继续判断2,一直递归循环,导致堆栈溢出。
this.close(); //3
3还是嵌套 所以栈溢出。。囧死了。谢谢