我在应用程序中检索了一些值,我可以在ListView
或TextView
中查看。但是相同的值可以存储或查看PDF,Word,Excel中的任何可能性
如果有请解释。
答案 0 :(得分:0)
希望这可以帮助...
public void appendLog(String text)
{
File logFile = new File("sdcard/log.txt");
if (!logFile.exists())
{
try
{
logFile.createNewFile();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try
{
//BufferedWriter for performance, true to set append to file flag
BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
buf.append(text);
buf.newLine();
buf.close();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
不要忘记在Manifest中添加writing_external_storage的权限!