2011-08-29 113 views
2

我試圖活性通過重寫的onPause方法與此代碼暫停之前顯示舉杯消息:如何在android中的onPause()之前顯示Toast消息?

@Override 
protected void onPause() { 
    Toast.makeText(this, "Paused", Toast.LENGTH_LONG); 
    super.onPause(); 
} 

http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle 活動將不被暫停,直到返回此方法:

"Implementations of this method must be very quick because the next activity will not be resumed until this method returns." 

然而烤麪包信息根本不顯示。

回答

8

變化: Toast.makeText(this, "Paused", Toast.LENGTH_LONG)

到:

Toast.makeText(this, "Paused", Toast.LENGTH_LONG).show()

+0

謝謝++。深夜我沒有注意到它。 –

相關問題