左晓为主开发手持机充值管理机
zuoxiao
2024-03-27 fe79cc8b05637b7dd3fc8f4c37a54e5f85da1efc
app/src/main/java/com/dayu/recharge/tools/NfcReadHelper.java
@@ -1,5 +1,6 @@
package com.dayu.recharge.tools;
import android.app.Activity;
import android.content.Intent;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
@@ -11,7 +12,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -29,7 +29,8 @@
    private static NfcReadHelper helper;
    public NfcReadHelper(Intent intent) {
    public NfcReadHelper(Intent intent, Activity activity) {
        super(activity);
        this.tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    }
@@ -40,9 +41,9 @@
     * @param intent
     * @return
     */
    public static NfcReadHelper getInstence(Intent intent) {
    public static NfcReadHelper getInstence(Intent intent, Activity activity) {
        if (helper == null) {
            helper = new NfcReadHelper(intent);
            helper = new NfcReadHelper(intent, activity);
        }
        return helper;
    }
@@ -132,7 +133,7 @@
                } else {
                    Log.i("NFCWreatActivity", "isOpen===" + isOpen);
                    return "-1";
                    return "-2";
                }
            } catch (IOException e) {
                return "-1";