J'ai un problème. J'ai besoin d'interrompre des liens qui ne sont pas statiques mais dont l'utilisateur créera la liste au moment de l'exécution. Je crée donc mon objet intentfilter au moment de l'exécution. Quand j'utilise le code dans le fichier manifest, cela fonctionne, mais l'utiliser dans une classe java ne fonctionne pas pour moi. Voici le code
Cela ne fonctionne pas
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_VIEW);
filter.addCategory(Intent.CATEGORY_DEFAULT);
filter.addCategory(Intent.CATEGORY_BROWSABLE);
filter.addDataAuthority("www.facebook.com", null);
filter.addDataScheme("http");
RecieveBroadcaster receiver = new RecieveBroadcaster();
registerReceiver(receiver, filter);
Mais si le réglage est statique, il fonctionne dans le manifeste
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http" android:host="twitter.com"/>
<data android:scheme="http" android:host="facebook.com"/>
</intent-filter>