安卓Android studio读写EM4305卡源码

这篇具有很好参考价值的文章主要介绍了安卓Android studio读写EM4305卡源码。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

安卓Android studio读写EM4305卡源码,18002295132,QQ:954486673,android,EM4305,安卓,java,动物标签

本示例使用的发卡器: https://item.taobao.com/item.htm?id=718720660087&spm=a1z10.5-c.w4002-21818769070.15.57dc6f89txUhXE

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="3dp"
    tools:context=".EM4305Activity">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:background="?attr/colorPrimary"
        app:navigationIcon="@drawable/baseline_arrow_back_ios_24"
        app:titleTextColor="@color/white"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteY="0dp">

        <TextView
            android:id="@+id/TextViewlabelDispleft"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="返回"
            android:textColor="@color/white"
            android:textSize="16sp"
            android:gravity="center"
            android:onClick="retmain" />

        <TextView
            android:id="@+id/TextViewlabelDisp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="EM4305卡测试页  "
            android:textColor="@color/white"
            android:textSize="16sp"
            android:gravity="center_horizontal|right|center"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/TextViewlabelDispleft"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.appcompat.widget.Toolbar>

    <TextView
        android:id="@+id/sample_text"
        android:layout_width="fill_parent"
        android:layout_height="150dp"
        android:padding="3dp"
        android:text="操作结果"
        android:textSize="12sp"
        android:background="@drawable/shape4border"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"

        />


    <ScrollView
        android:id="@+id/scrollViewIC"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_marginBottom="5dp"

        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar"
        app:layout_constraintBottom_toTopOf="@+id/sample_text"
        android:scrollbars="horizontal"
        >

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="3dp"
            >

            <CheckBox
                android:id="@+id/chkPwdEM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="带密码操作"
                android:textSize="12sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <EditText
                android:id="@+id/editTextPwdEM4305"
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:background="@drawable/shape4border"
                android:digits="0123456789ABCDEFabcdef"
                android:gravity="center"
                android:inputType="textCapCharacters"
                android:maxLength="8"
                android:maxLines="1"
                android:text="00000000"
                android:textSize="14sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkPwdEM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkPwdEM4305"
                app:layout_constraintTop_toTopOf="@+id/chkPwdEM4305"

                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="(十六进制)"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkPwdEM4305"
                app:layout_constraintLeft_toRightOf="@+id/editTextPwdEM4305"
                app:layout_constraintTop_toTopOf="@+id/chkPwdEM4305" />


            <CheckBox
                android:id="@+id/chkUidNeedEM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="仅操作指定卡号的卡"
                android:textSize="12sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/chkPwdEM4305" />

            <EditText
                android:id="@+id/editTextUidEM4305"
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:background="@drawable/shape4border"
                android:digits="0123456789ABCDEFabcdef"
                android:gravity="center"
                android:inputType="textCapCharacters"
                android:maxLength="8"
                android:maxLines="1"
                android:text="00000000"
                android:textSize="14sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkUidNeedEM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkUidNeedEM4305"
                app:layout_constraintTop_toTopOf="@+id/chkUidNeedEM4305"

                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="(十六进制)"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkUidNeedEM4305"
                app:layout_constraintLeft_toRightOf="@+id/editTextUidEM4305"
                app:layout_constraintTop_toTopOf="@+id/chkUidNeedEM4305" />


            <TextView
                android:id="@+id/TextViewlabel6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="返回数据:"
                android:textSize="12sp"
                app:layout_constraintBottom_toTopOf="@+id/TextViewRetDataEM4305"
                app:layout_constraintLeft_toLeftOf="parent" />

            <TextView
                android:id="@+id/TextViewRetDataEM4305"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/shape4border"
                android:padding="3dp"
                android:text=""
                android:textSize="12sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/btnRetDataClrEM4305"

                />

            <Button
                android:id="@+id/btnRetDataClrEM4305"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:onClick="textclear4305"
                android:text="清空数据"
                android:textSize="11sp"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/editTextUidEM4305" />

            <Button
                android:id="@+id/btnPwdChangeEM4305"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:onClick="changepwd4305"
                android:text="修改卡密码"
                android:textSize="11sp"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/TextViewRetDataEM4305" />

            <TextView
                android:id="@+id/TextViewlabel7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="新密码:"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/btnPwdChangeEM4305"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="@+id/btnPwdChangeEM4305"

                />

            <EditText
                android:id="@+id/editTextPwdNewEM4305"
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:background="@drawable/shape4border"
                android:digits="0123456789ABCDEFabcdef"
                android:gravity="center"
                android:inputType="textCapCharacters"
                android:maxLength="8"
                android:maxLines="1"
                android:text="00000000"
                android:textSize="14sp"
                app:layout_constraintBottom_toBottomOf="@+id/btnPwdChangeEM4305"
                app:layout_constraintLeft_toRightOf="@+id/TextViewlabel7"
                app:layout_constraintTop_toTopOf="@+id/btnPwdChangeEM4305" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="(十六进制)"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/editTextPwdNewEM4305"
                app:layout_constraintLeft_toRightOf="@+id/editTextPwdNewEM4305"
                app:layout_constraintTop_toTopOf="@+id/editTextPwdNewEM4305" />


            <CheckBox
                android:id="@+id/chkB0EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块0"
                android:textSize="11sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/btnPwdChangeEM4305" />

            <CheckBox
                android:id="@+id/chkB1EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块1(UID)"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB0EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB0EM4305" />

            <CheckBox
                android:id="@+id/chkB3EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块3"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB0EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB1EM4305" />

            <CheckBox
                android:id="@+id/chkB4EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块4(配置)"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB0EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB3EM4305" />

            <CheckBox
                android:id="@+id/chkB5EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块5"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB0EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB4EM4305" />

            <CheckBox
                android:id="@+id/chkB6EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块6"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB0EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB5EM4305" />

            <CheckBox
                android:id="@+id/chkB7EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块7"
                android:textSize="12sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/chkB0EM4305" />


            <CheckBox
                android:id="@+id/chkB8EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块8"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB7EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB7EM4305" />

            <CheckBox
                android:id="@+id/chkB9EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块9"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB8EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB8EM4305" />

            <CheckBox
                android:id="@+id/chkB10EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块10"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB8EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB9EM4305" />

            <CheckBox
                android:id="@+id/chkB11EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块11"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB8EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB10EM4305" />

            <CheckBox
                android:id="@+id/chkB12EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块12"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB8EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB11EM4305" />

            <CheckBox
                android:id="@+id/chkB13EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块13"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB8EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB12EM4305" />

            <CheckBox
                android:id="@+id/chkB14EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块14"
                android:textSize="11sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/chkB8EM4305" />

            <CheckBox
                android:id="@+id/chkB15EM4305"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="2dp"
                android:checked="false"
                android:text="块15"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/chkB14EM4305"
                app:layout_constraintLeft_toRightOf="@+id/chkB14EM4305" />

            <TextView
                android:id="@+id/TextViewlabel10"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="写入数据:"
                android:textSize="12sp"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/chkB14EM4305" />

            <EditText
                android:id="@+id/editTextDataEM4305"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:background="@drawable/shape4border"
                android:digits="0123456789ABCDEFabcdef"
                android:gravity="left"
                android:inputType="textCapCharacters"
                android:maxLength="128"
                android:padding="3dp"
                android:text="11111111"
                android:textSize="12sp"
                app:layout_constraintLeft_toLeftOf="@+id/TextViewRetDataEM4305"
                app:layout_constraintRight_toRightOf="@+id/TextViewRetDataEM4305"
                app:layout_constraintTop_toBottomOf="@+id/TextViewlabel10" />

            <Button
                android:id="@+id/btnReadEM4305"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:layout_marginRight="20dp"
                android:onClick="read4305"
                android:text="读卡"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/btnWriteEM4305"
                app:layout_constraintRight_toLeftOf="@+id/btnWriteEM4305" />

            <Button
                android:id="@+id/btnWriteEM4305"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:onClick="write4305"
                android:text="写卡"
                android:textSize="11sp"
                app:layout_constraintBottom_toTopOf="@+id/editTextDataEM4305"
                app:layout_constraintRight_toRightOf="parent" />

            <TextView
                android:id="@+id/TextViewlabel11"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="数据速率:"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/SpinnerDateRateEM4305"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="@+id/SpinnerDateRateEM4305" />

            <Spinner
                android:id="@+id/SpinnerDateRateEM4305"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:entries="@array/datarateEM4305"
                android:spinnerMode="dropdown"
                android:theme="@style/my_spinner_style"
                app:layout_constraintLeft_toRightOf="@+id/TextViewlabel11"
                app:layout_constraintTop_toBottomOf="@+id/editTextDataEM4305">

            </Spinner>

            <TextView
                android:id="@+id/TextViewlabel12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="调制模式:"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/SpinnerDateRateEM4305"
                app:layout_constraintRight_toLeftOf="@+id/SpinnerEncoderEM4305"
                app:layout_constraintTop_toTopOf="@+id/SpinnerDateRateEM4305" />

            <Spinner
                android:id="@+id/SpinnerEncoderEM4305"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:entries="@array/EncoderEM4305"
                android:spinnerMode="dropdown"
                android:theme="@style/my_spinner_style"
                app:layout_constraintBottom_toBottomOf="@+id/SpinnerDateRateEM4305"
                app:layout_constraintRight_toRightOf="parent">

            </Spinner>

            <Spinner
                android:id="@+id/SpinnerLoginModeEM4305"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:entries="@array/loginmodeEM4305"
                android:spinnerMode="dropdown"
                android:theme="@style/my_spinner_style"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/SpinnerEncoderEM4305">

            </Spinner>


            <TextView
                android:id="@+id/TextViewlabel13"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="自动发送最大块:"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/editTextMaxBlockEM4305"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="@+id/editTextMaxBlockEM4305" />

            <EditText
                android:id="@+id/editTextMaxBlockEM4305"
                android:layout_width="25dp"
                android:layout_height="wrap_content"
                android:background="@drawable/shape4border"
                android:digits="0123456789"
                android:gravity="left"
                android:inputType="textCapCharacters"
                android:maxLength="2"
                android:paddingLeft="3dp"
                android:text="6"
                android:textSize="12sp"

                app:layout_constraintLeft_toRightOf="@+id/TextViewlabel13"
                app:layout_constraintTop_toBottomOf="@+id/SpinnerLoginModeEM4305" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="范围:5-13块,时序从5块至最大块"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/editTextMaxBlockEM4305"
                app:layout_constraintLeft_toRightOf="@+id/editTextMaxBlockEM4305"
                app:layout_constraintTop_toTopOf="@+id/editTextMaxBlockEM4305" />



            <TextView
                android:id="@+id/TextViewlabel14"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="配置值:"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/editTextConfigWordEM4305"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="@+id/editTextConfigWordEM4305" />

            <EditText
                android:id="@+id/editTextConfigWordEM4305"
                android:layout_width="68dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:background="@drawable/shape4border"
                android:digits="0123456789ABCDEFabcdef"
                android:gravity="left"
                android:inputType="textCapCharacters"
                android:maxLength="8"
                android:paddingLeft="3dp"
                android:text="5F800100"
                android:textSize="12sp"
                app:layout_constraintLeft_toRightOf="@+id/TextViewlabel14"
                app:layout_constraintTop_toBottomOf="@+id/editTextMaxBlockEM4305" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="(十六进制)"
                android:textSize="12sp"
                app:layout_constraintBottom_toBottomOf="@+id/editTextConfigWordEM4305"
                app:layout_constraintLeft_toRightOf="@+id/editTextConfigWordEM4305"
                app:layout_constraintTop_toTopOf="@+id/editTextConfigWordEM4305" />

            <Button
                android:id="@+id/btnDefalutEM4305"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:layout_marginRight="20dp"
                android:onClick="default4305"
                android:text="← 默认值"
                android:textSize="11sp"
                app:layout_constraintBottom_toBottomOf="@+id/btnInitEM4305"
                app:layout_constraintRight_toLeftOf="@+id/btnInitEM4305" />


            <Button
                android:id="@+id/btnInitEM4305"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:onClick="init4305"
                android:text="设定配置"
                android:textSize="12sp"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/TextViewlabel14" />

        </androidx.constraintlayout.widget.ConstraintLayout>


    </ScrollView>


</androidx.constraintlayout.widget.ConstraintLayout>
package com.usbreadertest;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;

import com.reader.ouridr;
import com.reader.ourmifare;
public class EM4305Activity extends AppCompatActivity {
    private TextView tv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_em4305);
        androidx.appcompat.widget.Toolbar toolbar=findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        tv = findViewById(R.id.sample_text);
        tv.setText("操作结果");

        //增加输入监听事件
        // EM4305
        ((EditText)findViewById(R.id.editTextMaxBlockEM4305)).setOnFocusChangeListener(new View.OnFocusChangeListener(){

            @Override
            public void onFocusChange(View v,boolean FocusState) {
                if(FocusState){//进入焦点

                }
                else{//离开焦点
                    updateset4305();
                }

            }
        });

        //数据速率
        Spinner spls;
        spls = findViewById(R.id.SpinnerDateRateEM4305);
        spls.setSelection(2);//RF/16

        spls.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                updateset4305();
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });


        //调制模式
        ((Spinner)findViewById(R.id.SpinnerEncoderEM4305)).setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                updateset4305();
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        //加密模式
        ((Spinner)findViewById(R.id.SpinnerLoginModeEM4305)).setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                updateset4305();
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if(item.getItemId()==android.R.id.home){
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    public void retmain(View view)
    {
        finish();
    }

    public void textclear4305(View view)
    {
        TextView tvls;
        tvls = findViewById(R.id.TextViewRetDataEM4305);
        tvls.setText("");
    }
    public void changepwd4305(View view)
    {
        byte i;
        byte j;
        byte status;//存放返回值

        byte myctrlword;//控制字

        byte[] oldpicckey = new byte[4];//旧密码
        byte[] mypiccserial = new byte[4];//卡序列号
        byte[] newpicckey = new byte[4];//新密码

        myctrlword = 0; //NEEDSERIAL:需要只对指定系列号的卡操作,NEEDKEY:需要用密码认证,LOCKBIT:锁定块,KEYENABLE:启用本卡的密码功能

        String strls;

        CheckBox cbls;
        EditText etls;

        cbls = findViewById(R.id.chkPwdEM4305);
        if(!cbls.isChecked()) {//本次操作需要密码验证
            tv.setText("EM4305卡修改卡密码必须带密码操作");
            return;
        }

        etls = findViewById(R.id.editTextPwdEM4305);
        strls = etls.getText().toString().trim();
        if(strls.length() < 8)
        {
            tv.setText("旧密码长度不足8位");
            return;
        }
        for (i = 0; i < 4; i++) {
            oldpicckey[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
        }
        myctrlword += ouridr.NEEDKEY;

        cbls = findViewById(R.id.chkUidNeedEM4305);
        if(cbls.isChecked()) {//仅操作指定卡号的卡
            etls = findViewById(R.id.editTextUidEM4305);
            strls = etls.getText().toString().trim();
            if(strls.length() < 8)
            {
                tv.setText("卡号长度不足8位");
                return;
            }

            for (i = 0; i < 4; i++) {
                mypiccserial[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
            myctrlword += ouridr.NEEDSERIAL;

        }

        etls = findViewById(R.id.editTextPwdNewEM4305);
        strls = etls.getText().toString().trim();
        if(strls.length() < 8)
        {
            tv.setText("新密码长度不足8位!");
            return;
        }

        for (i = 0; i < 4; i++) {
            newpicckey[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
        }

        status = ouridr.em4305changekey(myctrlword,mypiccserial,oldpicckey,newpicckey);

        if(status == 0)
        {

            strls = "卡号[";

            strls += String.format("%02X%02X%02X%02X",mypiccserial[0],mypiccserial[1],mypiccserial[2],mypiccserial[3]);

            strls += "]";

            TextView tvls = findViewById(R.id.TextViewRetDataEM4305);
            tvls.setText(strls);

            strls = "EM4305卡修改卡密码成功";

            ouridr.beep(38);



        }
        else
        {

            if(status == 8)
            {
                strls = "请将卡放在感应区";
            }
            else if(status == 23)
            {
                strls = "错误代码:23,读卡器未插入";
            }
            else if(status == 1)
            {
                strls = "错误代码:1,卡放得远 或 需要密码才能写卡";
            }
            else if(status == 12)
            {
                strls = "错误代码:12,卡放得远 或 密码错误";
            }
            else
            {
                strls = "错误代码:" + Integer.toString(status);
            }

        }

        tv.setText(strls);
    }
    public void read4305(View view)
    {
        byte i;
        byte status;//存放返回值

        byte myctrlword;//控制字

        byte[] oldpicckey = new byte[4];//密码
        byte[] mypiccserial = new byte[4];//卡序列号
        byte[] mypiccdata = new byte[64];//读卡数据缓冲:卡无线转输分频比、卡内容长度(字节数),及最多返回12块的数据
        byte[] mypiccblockflag = new byte[2];//指定读哪一块

        myctrlword = 0; //NEEDSERIAL:需要只对指定系列号的卡操作,NEEDKEY:需要用密码认证,LOCKBIT:锁定块,KEYENABLE:启用本卡的密码功能

        String strls;

        CheckBox cbls;
        EditText etls;

        cbls = findViewById(R.id.chkPwdEM4305);
        if(cbls.isChecked()) {//本次操作需要密码验证
            etls = findViewById(R.id.editTextPwdEM4305);
            strls = etls.getText().toString().trim();
            if(strls.length() < 8)
            {
                tv.setText("密码长度不足8位");
                return;
            }
            for (i = 0; i < 4; i++) {
                oldpicckey[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
            myctrlword += ouridr.NEEDKEY;

        }

        cbls = findViewById(R.id.chkUidNeedEM4305);
        if(cbls.isChecked()) {//仅操作指定卡号的卡
            etls = findViewById(R.id.editTextUidEM4305);
            strls = etls.getText().toString().trim();
            if(strls.length() < 8)
            {
                tv.setText("卡号长度不足8位");
                return;
            }

            for (i = 0; i < 4; i++) {
                mypiccserial[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
            myctrlword += ouridr.NEEDSERIAL;

        }

        //操作块标志
        mypiccblockflag[0] = 0;

        cbls = findViewById(R.id.chkB0EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 1;
        }

        cbls = findViewById(R.id.chkB1EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 2;
        }

        cbls = findViewById(R.id.chkB3EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 8;
        }

        cbls = findViewById(R.id.chkB4EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 16;
        }

        cbls = findViewById(R.id.chkB5EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 32;
        }

        cbls = findViewById(R.id.chkB6EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 64;
        }

        cbls = findViewById(R.id.chkB7EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 128;
        }

        mypiccblockflag[1] = 0;

        cbls = findViewById(R.id.chkB8EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 1;
        }

        cbls = findViewById(R.id.chkB9EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 2;
        }

        cbls = findViewById(R.id.chkB10EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 4;
        }

        cbls = findViewById(R.id.chkB11EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 8;
        }

        cbls = findViewById(R.id.chkB12EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 16;
        }

        cbls = findViewById(R.id.chkB13EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 32;
        }

        cbls = findViewById(R.id.chkB14EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 64;
        }

        cbls = findViewById(R.id.chkB15EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 128;
        }

        status = ouridr.em4305read(myctrlword,mypiccserial,oldpicckey,mypiccblockflag,mypiccdata);

        if(status == 0)
        {

            strls = "卡无线转输分频比[" + Integer.toString(mypiccdata[0]) + "],卡号[";

            strls += String.format("%02X%02X%02X%02X",mypiccserial[0],mypiccserial[1],mypiccserial[2],mypiccserial[3]);

            strls += "],卡数据[";

            for (i = 0; i < mypiccdata[1]; i++) {
                strls += String.format("%02X",mypiccdata[i+2]);
            }

            strls += "]";

            TextView tvls = findViewById(R.id.TextViewRetDataEM4305);
            tvls.setText(strls);

            strls = "读EM4305卡成功";

            ouridr.beep(38);



        }
        else
        {

            if(status == 8)
            {
                strls = "请将卡放在感应区";
            }
            else if(status == 23)
            {
                strls = "错误代码:23,读卡器未插入";
            }
            else if(status == 4)
            {
                strls = "错误代码:4,卡放得远 或 需要密码才能读卡";
            }
            else if(status == 12)
            {
                strls = "错误代码:12,卡放得远 或 密码错误";
            }
            else
            {
                strls = "错误代码:" + Integer.toString(status);
            }

        }

        tv.setText(strls);
    }
    public void write4305(View view)
    {
        byte i;
        byte j;
        byte status;//存放返回值

        byte myctrlword;//控制字

        byte[] oldpicckey = new byte[4];//密码
        byte[] mypiccserial = new byte[4];//卡序列号
        byte[] mypiccdata = new byte[64];//读卡数据缓冲:卡无线转输分频比、卡内容长度(字节数),最多12块的数据
        byte[] mypiccblockflag = new byte[2];//指定读哪一块

        myctrlword = 0; //NEEDSERIAL:需要只对指定系列号的卡操作,NEEDKEY:需要用密码认证,LOCKBIT:锁定块,KEYENABLE:启用本卡的密码功能

        String strls;

        CheckBox cbls;
        EditText etls;

        cbls = findViewById(R.id.chkPwdEM4305);
        if(cbls.isChecked()) {//本次操作需要密码验证
            etls = findViewById(R.id.editTextPwdEM4305);
            strls = etls.getText().toString().trim();
            if(strls.length() < 8)
            {
                tv.setText("密码长度不足8位");
                return;
            }
            for (i = 0; i < 4; i++) {
                oldpicckey[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
            myctrlword += ouridr.NEEDKEY;

        }

        cbls = findViewById(R.id.chkUidNeedEM4305);
        if(cbls.isChecked()) {//仅操作指定卡号的卡
            etls = findViewById(R.id.editTextUidEM4305);
            strls = etls.getText().toString().trim();
            if(strls.length() < 8)
            {
                tv.setText("卡号长度不足8位");
                return;
            }

            for (i = 0; i < 4; i++) {
                mypiccserial[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
            myctrlword += ouridr.NEEDSERIAL;

        }

        //操作块标志
        j = 0;
        mypiccblockflag[0] = 0;

        cbls = findViewById(R.id.chkB0EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 1;
            j++;
        }

        cbls = findViewById(R.id.chkB1EM4305);
        if(cbls.isChecked()) {
            tv.setText("块1为只读,不允许写");
            return;
        }

        cbls = findViewById(R.id.chkB3EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 8;
            j++;
        }

        cbls = findViewById(R.id.chkB4EM4305);
        if(cbls.isChecked()) {
            tv.setText("块4为配置区,只能在初始化函数中操作");
            return;
        }

        cbls = findViewById(R.id.chkB5EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 32;
            j++;
        }

        cbls = findViewById(R.id.chkB6EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 64;
            j++;
        }

        cbls = findViewById(R.id.chkB7EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[0] += 128;
            j++;
        }

        mypiccblockflag[1] = 0;

        cbls = findViewById(R.id.chkB8EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 1;
            j++;
        }

        cbls = findViewById(R.id.chkB9EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 2;
            j++;
        }

        cbls = findViewById(R.id.chkB10EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 4;
            j++;
        }

        cbls = findViewById(R.id.chkB11EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 8;
            j++;
        }

        cbls = findViewById(R.id.chkB12EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 16;
            j++;
        }

        cbls = findViewById(R.id.chkB13EM4305);
        if(cbls.isChecked()) {
            mypiccblockflag[1] += 32;
            j++;
        }

        cbls = findViewById(R.id.chkB14EM4305);
        if(cbls.isChecked()) {
            tv.setText("块14为锁定标志块,只能在初始化函数中操作");
            return;
        }

        cbls = findViewById(R.id.chkB15EM4305);
        if(cbls.isChecked()) {
            tv.setText("块15为锁定标志块,只能在初始化函数中操作");
            return;
        }

        //写卡数据准备
        if(j == 0)
        {
            tv.setText("请先选择需要写入的块");
            return;
        }
        etls = findViewById(R.id.editTextDataEM4305);
        strls = etls.getText().toString().trim();
        if(strls.length() < (j*8))
        {
            tv.setText("写入数据长度不足,请补足数据!");
            return;
        }

        for (i = 0; i < (j*4); i++) {
            mypiccdata[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
        }

        status = ouridr.em4305write(myctrlword,mypiccserial,oldpicckey,mypiccblockflag,mypiccdata);

        if(status == 0)
        {

            strls = "卡号[";

            strls += String.format("%02X%02X%02X%02X",mypiccserial[0],mypiccserial[1],mypiccserial[2],mypiccserial[3]);

            strls += "]";

            TextView tvls = findViewById(R.id.TextViewRetDataEM4305);
            tvls.setText(strls);

            strls = "写EM4305卡成功";

            ouridr.beep(38);



        }
        else
        {

            if(status == 8)
            {
                strls = "请将卡放在感应区";
            }
            else if(status == 23)
            {
                strls = "错误代码:23,读卡器未插入";
            }
            else if(status == 1)
            {
                strls = "错误代码:1,卡放得远 或 需要密码才能写卡";
            }
            else if(status == 12)
            {
                strls = "错误代码:12,卡放得远 或 密码错误";
            }
            else
            {
                strls = "错误代码:" + Integer.toString(status);
            }

        }

        tv.setText(strls);
    }
    public void default4305(View view)
    {
        EditText etls;
        Spinner spls;

        etls = findViewById(R.id.editTextConfigWordEM4305);
        etls.setText("5F800100");
        etls = findViewById(R.id.editTextMaxBlockEM4305);
        etls.setText("6");

        spls = findViewById(R.id.SpinnerDateRateEM4305);//数据速率
        spls.setSelection(2);
        spls = findViewById(R.id.SpinnerEncoderEM4305);//调制模式
        spls.setSelection(0);
        spls = findViewById(R.id.SpinnerLoginModeEM4305);//加密模式
        spls.setSelection(0);
    }

    public void updateset4305()
    {
        EditText etls;
        EditText etMaxBlock;
        Spinner spls;
        String strls;
        byte i;

        byte[] Configdata = new byte[4];//配置值

        etls = findViewById(R.id.editTextConfigWordEM4305);
        strls = etls.getText().toString().trim();
        if(strls.length() < 8){
            strls = "5F800100";
            Configdata[0] = 0x5F;
            Configdata[1] = (byte)0x80;
            Configdata[2] = 0x01;
            Configdata[3] = 0x00;
        }
        else {
            for (i = 1; i < 4; i++) {
                Configdata[i] = (byte)Integer.parseInt(strls.substring(i * 2, i * 2 + 2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
        }

        spls = findViewById(R.id.SpinnerDateRateEM4305);//数据速率
        i = (byte)(spls.getSelectedItemId());
        Configdata[0] = 0x00;

        if(i == 0){//RF/32
            Configdata[0] |= 0x0f;
        }
        else if(i == 1) {//RF/40
            Configdata[0] |= 0x13;
        }
        else {//RF/64或其他
            Configdata[0] |= 0x1f;
        }

        spls = findViewById(R.id.SpinnerEncoderEM4305);//调制模式
        i = (byte)(spls.getSelectedItemId());
        if(i == 0){//曼切斯特码
            Configdata[0] |= 0x40;
        }
        else if(i == 1) {//Biphase码
            Configdata[0] |= 0x80;
        }
        else {//其他

        }

        Configdata[1] &= 0x3c;
        Configdata[2] &= 0x80;
        //自动发送最大块
        etMaxBlock = findViewById(R.id.editTextMaxBlockEM4305);
        strls = etMaxBlock.getText().toString().trim();
        if(strls.length() < 1){
            i = 6;
            etMaxBlock.setText("6");
        }
        else {
            i = (byte)Integer.parseInt(strls,10);
            if((i < 5) || (i > 13)){
                i = 6;
                etMaxBlock.setText("6");
            }
        }

        Configdata[1] |=  ((i % 4) * 64);
        Configdata[2] |= ((i / 4) % 4);

        spls = findViewById(R.id.SpinnerLoginModeEM4305);//密码规则(也就是读登陆或写登陆)
        i = (byte)(spls.getSelectedItemId());
        if(i == 1){//0-1块任意读,3-15块需密码读,0-13块任意写,14-15块需密码写
            i = 0x01;
        }
        else if(i == 2) {//0-15任意读,0-15块需密码写
            i = 0x04;
        }
        else if(i == 3) {//0-1块任意读,3-15块需密码读,0-15块需密码写
            i = 0x05;
        }
        else {//0-15块任意读.0-13块任意写,14-15块需密码写
            i = 0x00;
        }

        Configdata[2] |= (i * 4);

        etls.setText(String.format("%02X%02X%02X%02X",Configdata[0],Configdata[1],Configdata[2],Configdata[3]));

    }
    public void init4305(View view)
    {
        byte i;
        byte status;//存放返回值

        byte myctrlword;//控制字

        byte[] oldpicckey = new byte[4];//密码
        byte[] mypiccserial = new byte[4];//卡序列号
        byte[] mypiccdata = new byte[4];//写入数据缓冲

        myctrlword = 0; //NEEDSERIAL:需要只对指定系列号的卡操作,NEEDKEY:需要用密码认证,LOCKBIT:锁定块,KEYENABLE:启用本卡的密码功能

        String strls;

        CheckBox cbls;
        EditText etls;

        updateset4305();

        cbls = findViewById(R.id.chkPwdEM4305);
        if(cbls.isChecked()) {//本次操作需要密码验证
            etls = findViewById(R.id.editTextPwdEM4305);
            strls = etls.getText().toString().trim();
            if(strls.length() < 8)
            {
                tv.setText("密码长度不足8位");
                return;
            }
            for (i = 0; i < 4; i++) {
                oldpicckey[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
            myctrlword += ouridr.NEEDKEY;

        }


        cbls = findViewById(R.id.chkUidNeedEM4305);
        if(cbls.isChecked()) {//仅操作指定卡号的卡
            etls = findViewById(R.id.editTextUidEM4305);
            strls = etls.getText().toString().trim();
            if(strls.length() < 8)
            {
                tv.setText("卡号长度不足8位");
                return;
            }

            for (i = 0; i < 4; i++) {
                mypiccserial[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
            }
            myctrlword += ouridr.NEEDSERIAL;

        }

        //配置值:
        etls = findViewById(R.id.editTextConfigWordEM4305);
        strls = etls.getText().toString().trim();
        if(strls.length() < 8)
        {
            tv.setText("配置值输入长度不足8位");
            return;
        }
        for (i = 0; i < 4; i++) {
            mypiccdata[i] = (byte)Integer.parseInt(strls.substring(i*2,i*2+2),16);//只有用Integer.parseInt才能杜绝大于128时的错误
        }

        status = ouridr.em4305init(myctrlword,mypiccserial,oldpicckey,mypiccdata);

        if(status == 0)
        {

            strls = "卡号[";

            strls += String.format("%02X%02X%02X%02X",mypiccserial[0],mypiccserial[1],mypiccserial[2],mypiccserial[3]);

            strls += "]";

            TextView tvls = findViewById(R.id.TextViewRetDataEM4305);
            tvls.setText(strls);

            strls = "配置EM4305卡成功";

            ouridr.beep(38);

        }
        else
        {

            if(status == 8)
            {
                strls = "卡不在感应区 或 密码不正确";
            }
            else if(status == 23)
            {
                strls = "错误代码:23,读卡器未插入";
            }
            else if(status == 1)
            {
                strls = "错误代码:1,卡放得远 或 需要密码才能写卡";
            }
            else if(status == 12)
            {
                strls = "错误代码:12,卡放得远 或 密码错误";
            }
            else
            {
                strls = "错误代码:" + Integer.toString(status);
            }

        }

        tv.setText(strls);
    }

}

源码下载:AndroidstudioRFIDNFC读写源码资源-CSDN文库文章来源地址https://www.toymoban.com/news/detail-804753.html

到了这里,关于安卓Android studio读写EM4305卡源码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • android仿QQ列表实现 android studio大作业,android studio课程设计

    1. 效果图 2.功能介绍:登录,注册,好友列表 3.核心代码

    2024年02月11日
    浏览(45)
  • 在 Android Studio 中创建一个简单的 QQ 登录界面

            打开 Android Studio,选择 \\\"Start a new Android Studio project\\\",然后填写应用程序名称、包名和保存路径等信息。接下来,选择 \\\"Phone and Tablet\\\" 作为您的设备类型,然后选择 \\\"Empty Activity\\\" 作为您的 Activity 模板。         在 Android Studio 中,布局文件用于指定应用程序的用

    2024年02月07日
    浏览(45)
  • 安卓学习笔记:安卓11访问/读写 Android/data 目录

    省流提示:采用android studio工具开发,记录一次低级的开发,避免以后忘记或者踩坑。 最近有个业余项目开发到一小半,过程中需要读写 Android/data目录的文件,采用常规的文件操作总是提示权限被拒绝,无奈上网参考了很多资料,终于得到了解决。 无法访问Android/data 的原因

    2024年02月13日
    浏览(37)
  • [Android Studio]Android 数据存储-文件存储学习笔记-结合保存QQ账户与密码存储到指定文件中的演练

     🟧🟨🟩🟦🟪 Android Debug 🟧🟨🟩🟦🟪 Topic   发布安卓学习过程中遇到问题解决过程,希望我的解决方案可以对小伙伴们有帮助。 🪁文件存储 💾内部存储 📀存储数据到文件 💿从文件中读取数据 💯实战演练--保存QQ账号与密码 📖acticity_main.xml布局文件  📖 FileSave

    2023年04月14日
    浏览(46)
  • android免root读写u盘最新方法,支持安卓Q+

    本人是在写一个app需要读取u盘文件列表,网上找了好多方法,要不就是没有media权限,要不就是收不到广播,全部用不了,就这样搁置了一段时间终于又找到了一个大佬的方法,在这做个笔记 谷歌从Android5.0以上已经不支持开发者随便读写手机的外部存储(包含tf卡、otg外接

    2023年04月16日
    浏览(32)
  • [Android Studio] 导入安卓Android项目教程

    A项目指:要导入的项目;B项目指自己电脑上可以运行的项目 根据步骤一步一步来,别急。 将要导入的项目(简称为A)根目录下的这些文件删掉:.gradle、.idea 、.iml后缀的文件、 local.properties 进入app文件夹,将这些文件删掉:build、.iml后缀的文件 打开一个你在自己电脑上可

    2024年02月04日
    浏览(40)
  • Android Studio连接安卓手机

    点击右上角红框的【SDK Manager】-【SDK Tools】。 也可以在 【tools】-【SDK Manager】-【SDK Tools】下进入。 点击Google USB Driver,下载后点ok。 右键【我的电脑】-【高级系统设置】-【环境变量】,新建变量【Android_Home】; 值为:C:UsersHuoAppDataLocalAndroidSdk;C:UsersHuoAppDataLocalAnd

    2024年02月16日
    浏览(35)
  • Android studio 设置安卓手机

    参考这个链接 ghttps://developer.android.com/studio/debug/dev-options 列出常用手机的设置,但是我的手机不在此列 Google Pixel Settings    About phone    Build number Samsung Galaxy S8 and later Settings    About phone    Software information    Build number LG G6 and later Settings    About phone    Software info    Bui

    2024年02月13日
    浏览(34)
  • Android Studio 支持安卓手机投屏

    有时当我们在线上做技术分享或者功能演示时,希望共享连接中的手机屏幕,此时我们会求助 ApowerMirror,LetsView,Vysor,Scrcpy 等工具。如果你是一个 Android Developer,那么现在你有了更好的选择。 自 Android Studio Electric Eel (电鳗)起支持了手机投屏,且功能非常强大: 手机屏幕

    2024年01月17日
    浏览(44)
  • Android studio安卓虚拟机无法启动

    1 问题 曾经配置过并成功启动过安卓虚拟机,时隔若干年后无法启动,并总是自动杀死,除此之外没有任何有用信息: 2 原因排除: 首先是很多人都提到的中文路径名的原因:检查【系统高级设置-环境变量-系统变量】中的 ANDROID_SDK_HOME ,发现被我改成了 ANDROID_SDK_HOME_DELETE

    2024年02月04日
    浏览(33)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包