2013-04-21 41 views
0

我目前正在Android上開發一個簡單的應用程序。我有一個setonclicklistener imageview(Skype意圖)。當有人點擊這個圖像時出現對話框「完成操作使用....」。該對話框包含Skype的選項,這是理想的一個,但也包含了我的計算機上開發的所有應用程序。當有人點擊imageview時,我想要選擇只使用skype應用程序來完成操作。如果有可能消失在所有開放的Skype的對話框中的「使用完整的行動......」自動會更好。Android Skype的意圖

Skype的意圖:

final Intent sky = new Intent("android.intent.action.VIEW"); 
     sky.setData(Uri.parse("skype:" + "")); 
     ImageView imSky = (ImageView) findViewById(R.id.imageView2); 
     imSky.setOnClickListener(new View.OnClickListener() { 

      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(sky); 
      } 
     }); 

的Android的Manifest.xml與2意圖過濾器,我有,

 <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 

     <intent-filter> 
     <action android:name="android.intent.action.VIEW" /> 
     <category android:name="android.intent.category.DEFAULT" /> 
     <data android:scheme="skype" /> 
     </intent-filter>   

預先感謝您...

回答

0

此代碼將啓動Skype,那是你想要的嗎?

Intent intent = getActivity().getPackageManager().getLaunchIntentForPackage("com.skype.raider"); 
if (intent != null) 
{ 
    // start the activity 
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    startActivity(intent); 
} 
else 
{ 
    // bring user to the market 
    // or let them choose an app? 
    intent = new Intent(Intent.ACTION_VIEW); 
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    intent.setData(Uri.parse("market://details?id="+"com.skype.raider")); 
    startActivity(intent); 
} 
+0

感謝您的回覆, 我找到了解決方案。只是刪除 <類別機器人:名稱= 「android.intent.category.DEFAULT」/> 從manifest.xml中。現在它不會出現「完成操作使用」對話框,並重新回到Skype應用程序。 – 2013-04-21 12:25:07

+0

很高興能給出你的問題的答案... – 2013-04-21 13:08:29