Я тестирую в VirtualBox Oracle, с VM = «WSVGA 7.0 Tablet - 4.2.2 - API17»Подключение Intents намерению фильтров
Я не могу использовать 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 (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 ("com.estrongs.action .PICK_FILE "); Intent intent = new Intent ("com.example.filechooser.PICK_DIRECTORY");
Просим прощения за форматирование. Я долго пробовал удовлетворять запросы форума о ошибке «содержит код» и после десятков сбоев я ушел после первого успеха. – NormR