Fix NPE in BeamDemo if NFC not present. do not merge.

Bug: 6711303

(cherry picked from commit 76aca97d26)

Change-Id: I626d060bf2951c213679685dc57ee2eda7398da2
This commit is contained in:
Martijn Coenen
2012-06-21 15:26:04 -07:00
committed by Xavier Ducrohet
parent ddb532df58
commit 0c3d438a93

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);
}