String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
"Linux", "OS/2" };
Log.d("list",TextUtils.join(",", values));
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, values);
setListAdapter(adapter);
String a="hi is";
File myFile = new File("/sdcard/mysdcardfile.txt");
try {
myFile.createNewFile();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
//byte[] anotherArray = new byte[values.length];
byte data[] = new byte[1024];
int count;
long total = 0;
FileOutputStream output = new FileOutputStream(myFile);
while ((count = values.length) != -1) {
total += count;
// FileWriter fos = new FileWriter(myFile);
// BufferedWriter bis = new BufferedWriter(fos);
output.write(data, 0, count);
//bis.close();
//fos.close();
output.close();
}
这里我的值以文本格式存储在我的 SD 卡中。但是当我打开文本文件时,它包含字节。这里的值存储在字节中。当我写文件输出流时如何将字节更改为字符串。我想得到文本文件中的值。