XML : how to make xml file from strings?

basically i have an app that use bluetooth to transfer xml file. i have done those steps i have managed to open xml file and read each line from that xml file and send it via bluetooth to other device , the other device has gotten the strings(from LOG PRINTS) but i wanna fiqure out how from those strings i can make the xml file in the other device

heres the code for the phone who receives the strings

can someone help me ?

      public void run() {      byte[] buffer = new byte[1024];  // buffer store for the stream        Log.d(TAG,"TRYING TO READ STRINGES");      // Keep listening to the InputStream until an exception occurs      while (true) {          try {              Log.d(TAG,"LISTING TO A NEW STRINGS ");              int read = -1;              final byte[] bytes = new byte[2048];              for (; (read = mmInStream.read(bytes)) > -1;) {                  final int count = read;             //     Log.d(TAG,"String size is"+count);                  runOnUiThread(new Runnable() {                      public void run() {                          String readMessage = new String(bytes, 0, count);                          xmlString = xmlString.concat(readMessage);                          Log.d(TAG, "String is " + readMessage);                      }                  });              }            } catch (IOException e) {              break;          }      }  }    

No comments:

Post a Comment