我试图按照MACC is on the right track, let’s hope it will go all the way.txt
文章的标题来拉取我的文件名编程的文本文件,但拉上它会给我这个错误:
[2016-08-29 11:59:06 - ddms] transfer error: No such file or directory
[2016-08-29 11:59:06] Failed to pull selection: No such file or directory
当我尝试删除
时java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:206)
at com.android.ddmlib.JdwpPacket.movePacket(JdwpPacket.java:235)
at com.android.ddmlib.Debugger.sendAndConsume(Debugger.java:347)
at com.android.ddmlib.Client.forwardPacketToDebugger(Client.java:707)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:344)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
我的源代码
public void storeHTML(Context context, ArrayList<String> storeHTML) {
try {
File root = new File(Environment.getExternalStorageDirectory(), "voicethenews");
if (!root.exists()) {
root.mkdirs();
}
File gpxfile = new File(root, storeHTML.get(0) + ".txt");
FileWriter writer = new FileWriter(gpxfile);
//BufferedWriter bufferedWriter = new BufferedWriter(writer);
for(int i = 1; i < storeHTML.size(); i++) {
//bufferedWriter.newLine();
writer.append(System.getProperty("line.separator") + storeHTML.get(i));
}
writer.flush();
writer.close();
Toast.makeText(context, "Saved", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}
我已经高低搜索了答案仍然没有设法解决它。谢谢。
答案 0 :(得分:1)
请测试此代码:
Instant