Fix NPE in BeamDemo if NFC not present.

Bug: 6711303
Change-Id: Iad6abab3ea2ca53247ed4e3b5149e052bd92453b
This commit is contained in:
Martijn Coenen
2012-06-21 15:26:04 -07:00
parent 547975cf50
commit 76aca97d26

View File

@@ -56,11 +56,12 @@ public class Beam extends Activity implements CreateNdefMessageCallback,
if (mNfcAdapter == null) {
mInfoText = (TextView) findViewById(R.id.textView);
mInfoText.setText("NFC is not available on this device.");
} else {
// Register callback to set NDEF message
mNfcAdapter.setNdefPushMessageCallback(this, this);
// Register callback to listen for message-sent success
mNfcAdapter.setOnNdefPushCompleteCallback(this, this);
}
// Register callback to set NDEF message
mNfcAdapter.setNdefPushMessageCallback(this, this);
// Register callback to listen for message-sent success
mNfcAdapter.setOnNdefPushCompleteCallback(this, this);
}