Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Android应用程序中从蓝牙接收文本文件_Android_Bluetooth - Fatal编程技术网

在Android应用程序中从蓝牙接收文本文件

在Android应用程序中从蓝牙接收文本文件,android,bluetooth,Android,Bluetooth,我想从另一个Android设备接收文本文件,该设备将发送文本文件格式的读取,我想读取并将其存储在数据库中,我已经完成了读取和存储部分,但我无法理解如何通过蓝牙接收文件并读取该文本文件 我得到了发送文件的所有代码,但没有收到文本文件。我已经尝试了很多代码,但它不能满足我的需要 以下是我读取文本文件的代码: String []message=null; BufferedReader br=null; String name1, faculty1, deparment1, offic

我想从另一个Android设备接收文本文件,该设备将发送文本文件格式的读取,我想读取并将其存储在数据库中,我已经完成了读取和存储部分,但我无法理解如何通过蓝牙接收文件并读取该文本文件

我得到了发送文件的所有代码,但没有收到文本文件。我已经尝试了很多代码,但它不能满足我的需要

以下是我读取文本文件的代码:

String []message=null;

    BufferedReader br=null;
    String name1, faculty1, deparment1, officeNumber1, email1, phone1, gl1, bp1;
    long e;
    try{
        String sCurrentLine = null;

        br =new BufferedReader(new InputStreamReader(getAssets().open("1.txt")));


        while((sCurrentLine = br.readLine()) != null) {

            if(sCurrentLine != null )

                message=sCurrentLine.split("\\s+");

            faculty1 = message[0];
            deparment1 = message[1];
            name1 = message[2];
            officeNumber1 = message[3];
            gl1 = message[4];
            bp1 = message[5];
            phone1 = message[6];

            ContentValues values = new ContentValues(7);
            values.put(hr, faculty1);
            values.put(rr, deparment1);
            values.put(spo2, name1);
            values.put(hb, officeNumber1);
            values.put(time, phone1);
            values.put(gl, gl1);
            values.put(bp, bp1);
            Log.w("aa", faculty1);
            Log.w("aa", gl);
            Log.w("aa", bp);
            dataBase.insert(TABLE_NAME, values);
            updateTextView();

您可以尝试客户端-服务器体系结构。将发送设备设为客户端,将接收设备设为服务器。

检查此项