Activity.onPause() -> MessageSender.stopSending sets mThis to null, then a last message gets sent and a crash in newMessage().
Fix this by
1) making the Message inner class static (so that we can create a new one without a reference to mThis) 2) move the locking from mThis (which is not final) to a specialized final Object mLock.
Fix for a crash when exiting an app:
Activity.onPause() -> MessageSender.stopSending sets mThis to null, then a last message gets sent and a crash in newMessage().
Fix this by
1) making the Message inner class static (so that we can create a new one without a reference to mThis)
2) move the locking from mThis (which is not final) to a specialized final Object mLock.