android.nfc.tech.Ndef.isWritable()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中android.nfc.tech.Ndef.isWritable()方法的一些代码示例,展示了Ndef.isWritable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ndef.isWritable()方法的具体详情如下:
包路径:android.nfc.tech.Ndef
类名称:Ndef
方法名:isWritable

Ndef.isWritable介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

if (!ndef.isWritable()) {
 text="Tag is read-only";

代码示例来源:origin: commonsguy/cw-omnibus

if (!ndef.isWritable()) {
 text=host.getString(R.string.tag_is_read_only);

代码示例来源:origin: RickyYu/Nfc-Android

ndef.connect();
if (!ndef.isWritable()) {
  return;

代码示例来源:origin: RickyYu/Nfc-Android

ndef.connect();
if (!ndef.isWritable()) {
  return;

代码示例来源:origin: skjolber/ndef-tools-for-android

if (!ndef.isWritable()) {
  Log.d(TAG, "Capacity of non-writeable tag is zero");

代码示例来源:origin: Mobisocial/EasyNFC

if (ndef != null) {
  ndef.connect();
  if (!ndef.isWritable()) {
    Log.w(TAG, "Tag is read-only.");
    return OnTagWriteListener.WRITE_ERROR_READ_ONLY;

代码示例来源:origin: bparmentier/WiFiKeyShare

if (ndef != null) {
  ndef.connect();
  if (!ndef.isWritable()) {
    Log.w(TAG, "Tag not writable");
    return false;

代码示例来源: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;
  }
}

代码示例来源:origin: skjolber/ndef-tools-for-android

if (!ndef.isWritable()) {
  Log.d(TAG, "Tag is not writeable");

相关文章