我正在使用 VM="WSVGA 7.0 Tablet - 4.2.2 - API17" 在 Oracle 的 VirtualBox 中进行测试
我无法使用 Intent 通过以下代码连接到应用程序:
Intent intent = new Intent("com.estrongs.action.PICK_FILE"); Intent intent = new Intent("com.example.filechooser.PICK_DIRECTORY"); // intent.setDataAndTypeAndNormalize(Uri.parse("file://"), "*/*"); //No Activity found to handle Intent { act=com.estrongs.action.PICK_FILE dat=file:// typ=*/* } //No Activity found to handle Intent { act=com.estrongs.action.PICK_FILE } // intent.setType("*/*"); //No Activity found to handle Intent { act=com.estrongs.action.PICK_FILE typ=file/* } //No Activity found to handle Intent { act=com.estrongs.action.PICK_FILE typ=*/* } // NOTE: Extra space at end of action above. removed below //No Activity found to handle Intent { act=com.estrongs.action.PICK_FILE typ=*/* } //No Activity found to handle Intent { act=com.example.filechooser.PICK_DIRECTORY typ=*/* } //No Activity found to handle Intent { act=com.example.filechooser.PICK_DIRECTORY }
// startActivityForResult(intent, FolderChosen);
>
从我的 AndroidManifest.xml 中:
<intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.GET_CONTENT" /> <category android:name="android.intent.category.OPENABLE" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="*/*" /> </intent-filter> <intent-filter> <action android:name="com.example.filechooser.PICK_DIRECTORY" /> </intent-filter>
> 我确实做到了:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setDataAndTypeAndNormalize(Uri.parse("file://"), " / "); // 文件:// 工作
// onCreate intent=Intent { act=android.intent.action.GET_CONTENT dat=file:// typ=*/*
// flg=0x3000000 cmp=com.example.filechooser/.FileChooser } <<<<<<<<<<<<<NOTE: WORKED
我应该如何编写一个可以由如下意图选择的意图过滤器:
Intent intent = new Intent("com.estrongs.action.PICK_FILE"); Intent intent = new Intent("com.example.filechooser.PICK_DIRECTORY");