Fix NPE in BeamDemo if NFC not present.
Bug: 6711303 Change-Id: Iad6abab3ea2ca53247ed4e3b5149e052bd92453b
This commit is contained in:
@@ -56,12 +56,13 @@ public class Beam extends Activity implements CreateNdefMessageCallback,
|
|||||||
if (mNfcAdapter == null) {
|
if (mNfcAdapter == null) {
|
||||||
mInfoText = (TextView) findViewById(R.id.textView);
|
mInfoText = (TextView) findViewById(R.id.textView);
|
||||||
mInfoText.setText("NFC is not available on this device.");
|
mInfoText.setText("NFC is not available on this device.");
|
||||||
}
|
} else {
|
||||||
// Register callback to set NDEF message
|
// Register callback to set NDEF message
|
||||||
mNfcAdapter.setNdefPushMessageCallback(this, this);
|
mNfcAdapter.setNdefPushMessageCallback(this, this);
|
||||||
// Register callback to listen for message-sent success
|
// Register callback to listen for message-sent success
|
||||||
mNfcAdapter.setOnNdefPushCompleteCallback(this, this);
|
mNfcAdapter.setOnNdefPushCompleteCallback(this, this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user