调用 getInflater() 方法时出现 StackOverflowError 异常。我试图调用该方法并将其传递给另一个对象以调用 View arg3=inflater.inflate(R.layout.lastrow_layout, null) 方法。那么为什么会发生这种类型的错误我该如何解决这个问题?或者有什么方法可以在不传递充气对象的情况下做同样的事情?这是错误日志。
GC_FOR_ALLOC freed 88K, 9% free 2645K/2884K, paused 73ms, total 89ms
threadid=1: stack overflow on call to Lcom/example/ikmantest2/MainActivity;.getInf later:L method requires 8+20+4=32 bytes, fp is 0x4364f318 (24 left) expanding stack end (0x4364f300 to 0x4364f000) Shrank stack (to 0x4364f300, curFrame is 0x43654ec4) Shutting down VM threadid=1: thread exiting with uncaught exception (group=0x40a71930) GC_CONCURRENT freed 12K, 5% free 3146K/3304K, paused 77ms+79ms, total 249ms
09-07 08:40:57.719: D/dalvikvm(1155): WAIT_FOR_CONCURRENT_GC blocked 13ms
FATAL EXCEPTION: main
java.lang.StackOverflowError atcom. example. ikmantest2. MainActivity.getInflater(MainActivity.java:253)
这是给出错误的代码。(这在 Activity_Main.java 中)
public LayoutInflater getInflater() {
return getInflater();
}
而这个 Inflater 对象在另一个类中用作 this;
View arg3=inflater.inflate(R.layout.lastrow_layout, null)