0
我正在尝试使用此代码。文件未找到复制Android文件时出现异常
public synchronized void onActivityResult(final int requestCode, int resultCode,
final Intent data) {
String filePath = null;
if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case RESULT_MEMORY_SAVE:
filePath = data.getDataString();
copyFileForReceipts(filePath,pathOfReceipts);
现在filepath是一个字符串,调试器显示出其价值"content://media/external/images/media/133"
接下来我将尝试使用此:
sourceLocation = filePath;
File afile = new File(sourceLocation);
File bfile = new File(targetLocation + "file.jpg");
inStream = new FileInputStream(afile.getName()); //Gives exception
outStream = new FileOutputStream(bfile.getName());
它给人FileNotFound
例外的例外。我也尝试删除.getName()
。
请告诉我我在哪里错了。
问候