1

我想从 android 应用程序上传服务器上的文件。因此用户可以从最近的图像、文档或 android 应用程序中的任何 PDF 中选择任何文件,并将上传到服务器上。

所以请告诉我如何打开最近的活动并选择任何文件以及如何将其上传到服务器上。

请帮助我这对我来说非常重要。

4

1 回答 1

0

您可以*/*像在 android 中一样打开所有文件。

Intent intent = new Intent();    
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, getString(R.string.perform_action_with)), attachmentChoice);

注意:ConstantattachmentChoice在哪里。

于 2015-09-30T05:10:54.893 回答