2013-04-21 76 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