如何发送CSV /文本文件从Android手机向无线打印机?

问题描述:

我开发一个Android应用程序是我应该从CSV / TXT文件格式的数据库中获取的数据,稍后我将文件发送到一个WiFi打印机。

I am developing an Android application were I am supposed to get the data from a database in csv/txt file format and later I have to send the files to a wifi printer.

难道有谁知道我可能会开始这样做了吗?

Do anyone know how I might get started doing that?

答案终于简单:

 Socket client = new Socket(_IP, PORT);

 oStream = new PrintStream(client.getOutputStream(), true, "UTF-8");

 oStream.println("-------------------------------------------------\r\n");
 oStream.println(" NAME     : DEMO CLIENT\r\n");
oStream.println(" CODE  : 00000234242\r\n");
oStream.println(" ADDRESS   : Street 52\r\n");
oStream.println(" Phone : 2310-892345\r\n");
oStream.println("-------------------------------------------------\r\n");

oStream.flush();

oStream.close();
client.close();