我正在尝试读取文本文件并将这些文本文件中的数据插入 URL;但我有这个错误“java.lang.illegalargumentexception 包含路径分隔符文件”
这是我使用的读取方法
>
public String ReadFile (String Path){
String res = null;
try {
String filePath = android.os.Environment.getExternalStorageDirectory().getPath() + "/" + Path;
File file = new File(filePath);
if(file.exists()){
InputStream in = openFileInput(filePath);
if (in != null) {
// prepare the file for reading
InputStreamReader input = new InputStreamReader(in);
BufferedReader buffreader = new BufferedReader(input);
res = "";
String line;
while (( line = buffreader.readLine()) != null) {
res += line;
}
in.close();
}else{
}
}else{
Toast.makeText(getApplicationContext(), "The File" + Path + " not Found" ,Toast.LENGTH_SHORT).show();
}
} catch(Exception e){
Toast.makeText(getApplicationContext(),e.toString() + e.getMessage(),Toast.LENGTH_SHORT).show();
}
return res;
}
> String sendername = ReadFile ("SenderName.txt");
String AccountName = ReadFile ("AccountName.txt");
String AccountPassword = ReadFile ("AccountPassword.txt");
String MsgText = ReadFile ("MsgText.txt");
谢谢,