本文整理了Java中android.nfc.tech.Ndef.getMaxSize()
方法的一些代码示例,展示了Ndef.getMaxSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ndef.getMaxSize()
方法的具体详情如下:
包路径:android.nfc.tech.Ndef
类名称:Ndef
方法名:getMaxSize
暂无
代码示例来源:origin: commonsguy/cw-omnibus
text="Tag is read-only";
else if (ndef.getMaxSize()<size) {
text="Message is too big for tag";
代码示例来源:origin: commonsguy/cw-omnibus
text=host.getString(R.string.tag_is_read_only);
else if (ndef.getMaxSize() < size) {
text=host.getString(R.string.message_is_too_big_for_tag);
代码示例来源:origin: RickyYu/Nfc-Android
@Override
public void onNewIntent(Intent intent) {
//获取Tag对象
Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
//获取Ndef的实例
Ndef ndef = Ndef.get(detectedTag);
mTagText = ndef.getType() + "\n max size:" + ndef.getMaxSize() + " bytes\n\n";
readNfcTag(intent);
mNfcText.setText(mTagText);
}
代码示例来源:origin: RickyYu/Nfc-Android
@Override
public void onNewIntent(Intent intent) {
//1.获取Tag对象
Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
//2.获取Ndef的实例
Ndef ndef = Ndef.get(detectedTag);
mTagText = ndef.getType() + "\nmaxsize:" + ndef.getMaxSize() + "bytes\n\n";
readNfcTag(intent);
mNfcText.setText(mTagText);
}
代码示例来源:origin: Mobisocial/EasyNFC
return OnTagWriteListener.WRITE_ERROR_READ_ONLY;
if (ndef.getMaxSize() < size) {
Log.d(TAG, "Tag capacity is " + ndef.getMaxSize() + " bytes, message is " +
size + " bytes.");
return OnTagWriteListener.WRITE_ERROR_CAPACITY;
代码示例来源:origin: RickyYu/Nfc-Android
if (ndef.getMaxSize() < size) {
return;
代码示例来源:origin: skjolber/ndef-tools-for-android
int maxSize = ndef.getMaxSize();
代码示例来源:origin: RickyYu/Nfc-Android
if (ndef.getMaxSize() < size) {
return;
代码示例来源:origin: skjolber/ndef-tools-for-android
if (ndef.getMaxSize() < rawMessage.toByteArray().length) {
Log.d(TAG, "Tag size is too small, have " + ndef.getMaxSize() + ", need " + rawMessage.toByteArray().length);
writeNdefTooSmall(rawMessage.toByteArray().length, ndef.getMaxSize());
代码示例来源:origin: bparmentier/WiFiKeyShare
return false;
int ndefMaxSize = ndef.getMaxSize();
if (messageSize > ndefMaxSize) {
代码示例来源:origin: RickyYu/Nfc-Android
/**
* 写入标签
*
* @param message
* @param tag
* @return
*/
public static boolean writeTag(NdefMessage message, Tag tag) {
int size = message.toByteArray().length;
try {
Ndef ndef = Ndef.get(tag);
if (ndef != null) {
ndef.connect();
if (!ndef.isWritable()) {
return false;
}
if (ndef.getMaxSize() < size) {
return false;
}
ndef.writeNdefMessage(message);
return true;
}
} catch (Exception e) {
}
return false;
}
}
内容来源于网络,如有侵权,请联系作者删除!