2012-03-06 14 views
2

問題があります。私は静的ではないリンクを介在させる必要がありますが、ユーザーは実行時にすべてのリストを作成します。だから、実行時にintentfilterオブジェクトを作成しています。だから、マニフェストファイルでコードを使用すると、Javaクラスでそれを使用しても動作しません。ここではこれがIntentFilterが作成されたランタイムで動作しない

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); 

が動作していないコード

だ。しかし、それはこの場合、マニフェスト

 <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>  
+0

http://stackoverflow.com/questions/2230280/capturing-home-intent-programmaticallyこのリンクは役に立つかもしれません – Triode

+0

[私のアプリへのインターアップリングリンク](http://stackoverflow.com/questions/9579447)/interupting-link-my-app) – Luksprog

答えて

0

に働く静的に設定した場合、それは自分の権威が一致していないということかもしれません。マニフェストバージョンでは、android:host = "facebook.com"、プログラムバージョンでは、addDataAuthority( "www.facebook.com"、null)

と一致する必要があります。

関連する問題