Tabnine Logo
MifareUltralight.connect
Code IndexAdd Tabnine to your IDE (free)

How to use
connect
method
in
android.nfc.tech.MifareUltralight

Best Java code snippets using android.nfc.tech.MifareUltralight.connect (Showing top 3 results out of 315)

origin: RickyYu/Nfc-Android

  public String readTag(Tag tag) {
    MifareUltralight ultralight = MifareUltralight.get(tag);
    try {
      ultralight.connect();
      byte[] data = ultralight.readPages(4);
      return new String(data, Charset.forName("GB2312"));
    } catch (Exception e) {
    } finally {
      try {
        ultralight.close();
      } catch (Exception e) {
      }
    }
    return null;
  }
}
origin: RickyYu/Nfc-Android

  public void writeTag(Tag tag) {
    MifareUltralight ultralight = MifareUltralight.get(tag);
    try {
      ultralight.connect();
      //写入八个汉字,从第五页开始写,中文需要转换成GB2312格式
      ultralight.writePage(4, "北京".getBytes(Charset.forName("GB2312")));
      ultralight.writePage(5, "上海".getBytes(Charset.forName("GB2312")));
      ultralight.writePage(6, "广州".getBytes(Charset.forName("GB2312")));
      ultralight.writePage(7, "天津".getBytes(Charset.forName("GB2312")));
      Toast.makeText(this, "写入成功", Toast.LENGTH_SHORT).show();
    } catch (Exception e) {
    } finally {
      try {
        ultralight.close();
      } catch (Exception e) {
      }
    }
  }
}
origin: skjolber/external-nfc-api

  throw new IllegalArgumentException("No Mifare Ultralight");
mifareUltralight.connect();
android.nfc.techMifareUltralightconnect

Popular methods of MifareUltralight

  • get
  • close
  • getType
  • readPages
  • transceive
  • writePage

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Kernel (java.awt.image)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now