[英]How can I access downloads/data folder in Android device?
我正在構建一個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的教程。
http://www.vogella.com/articles/AndroidNetworking/article.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.