浏览后我知道 Stackoverflow 错误是由于方法的递归调用,这是我的代码,我得到上述错误,但无法解决这个问题。
public static GameLayer sharedGameLayer() {
return sharedGameLayer();
}
logcat 错误
09-16 15:13:30.074: E/AndroidRuntime(1597): FATAL EXCEPTION: main
09-16 15:13:30.074: E/AndroidRuntime(1597): java.lang.StackOverflowError
09-16 15:13:30.074: E/AndroidRuntime(1597): at com.ps.GameLayer.sharedGameLayer(GameLayer.java:533)
09-16 15:13:30.074: E/AndroidRuntime(1597): at com.ps.GameLayer.sharedGameLayer(GameLayer.java:533)
09-16 15:13:30.074: E/AndroidRuntime(1597): at com.ps.GameLayer.sharedGameLayer(GameLayer.java:533)
09-16 15:13:30.074: E/AndroidRuntime(1597): at com.ps.GameLayer.sharedGameLayer(GameLayer.java:533)