學習http://developer.android.com/guide/topics/fundamentals/services.html#ExtendingService,Android服務中的消息是什麼?
代碼,我看到這個
Message msg = mServiceHandler.obtainMessage();
但不是已經說了很多關於這一點。我試圖運行的代碼,並使用下面的代碼啓動服務:
Intent intent = new Intent(this, NewCheckpointService.class);
startService(intent);
的服務可以正常啓動,但是我面對一個空指針,當談到獲得的消息。也就是說,變量msg爲空。
任何人都可以解釋什麼是消息對象用於,以及如何使用它? (最好有例子)。
謝謝!