我有一个简单的Android应用程序,可以从计算机的硬盘驱动器中读取文本文件。
所以我曾经
try
{
File myFile = new File("E:\\myFolder\\"+name);
Log.i("Test", "Path = "+myFile.getAbsolutePath().toString());
FileInputStream fIn = new FileInputStream(myFile);
BufferedReader myReader = new BufferedReader(new InputStreamReader(fIn));
String aDataRow = "";
while ((aDataRow = myReader.readLine()) != null)
{
UpdateArray.add(aDataRow);
}
myReader.close();
return UpdateArray;
}
catch (FileNotFoundException e)
{
Toast.makeText(getBaseContext(), "File is Not Present at Location.", Toast.LENGTH_LONG).show();
return null;
}
catch (Exception e)
{
Toast.makeText(getBaseContext(), "Something Went Wrong.", Toast.LENGTH_LONG).show();
return null;
}
但是它是“该位置不存在文件”。吐司
请帮我。
默认情况下,您的Android设备无法访问台式机,并且可以肯定没有Windows驱动器号。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句