Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何访问Android设备中的下载/数据文件夹?_Android_Android Dialog - Fatal编程技术网

如何访问Android设备中的下载/数据文件夹?

如何访问Android设备中的下载/数据文件夹?,android,android-dialog,Android,Android Dialog,我正在构建一个Android应用程序,在其中我必须将文件上传到http服务器。例如,我的下载/数据文件夹中的文档。我怎样才能访问。我需要在清单中设置权限吗 我这样做: private static final int PICKFILE_RESULT_CODE = 1; String selectedPath = ""; Intent intent = new Intent(); intent.setType("file/*"); intent.setAction(Intent.ACTION_GE

我正在构建一个Android应用程序,在其中我必须将文件上传到http服务器。例如,我的下载/数据文件夹中的文档。我怎样才能访问。我需要在清单中设置权限吗

我这样做:

private static final int PICKFILE_RESULT_CODE = 1;
String selectedPath = "";
Intent intent = new Intent();
intent.setType("file/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent,PICKFILE_RESULT_CODE);
我在我的第二个活动中这样做,并将此活动添加到清单中。我收到了这些错误

10-16 06:00:30.065: E/AndroidRuntime(546): FATAL EXCEPTION: main
10-16 06:00:30.065: E/AndroidRuntime(546): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.GET_CONTENT typ=file/* }

您将需要INTERNET和READ_PHONE_STATE的权限

至于将文档拉入手机,您需要通过http发出GET或POST

下面是关于Android中HTTP的教程