2012-11-15 38 views
0

我想知道在執行此操作後如何從Gameview類調用int值:setContentView(new GameView(this, this));。 在設置內容視圖之後設置一個像 GameView game = new GameView(this , this);這樣的新實例就會使我的程序崩潰。有沒有其他辦法來檢索我的int值?在設置類的上下文之後獲取類實例

+0

如何在setContentView之前創建實例並重用它? –

+0

你的意思是這樣嗎?'GameView game = new GameView(this,this);''setContentView(game);' – CtheW

+0

Offtopic:爲什麼你有2個參數,'this'? – RvdK

回答

0

我的setContentView(new GameView(this, this));開始它並幫助解決部分崩潰後添加一個system.gc。但是如果代碼在仍然未被證實之後仍然正常工作。