2011-11-23 78 views

回答

0

您可以获取设备上已安装应用程序的列表,并检查您正在查找的应用程序是否已安装。然后给用户一个选项来选择他想要共享的应用程序通过

List<ApplicationInfo> packages = getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA); 

for (ApplicationInfo appInfo : packages) { 
    if ("com.facebook.katana".equals(appInfo.packageName)) { 
     // Facebook app is installed, add to options list 
    } 

    // Do something similar for Twitter and Gmail 
} 

// Show user the options list 
+0

如何添加到选项列表?我的意思是当我们调用ACTION_SEND时,会出现一个包含客户端应用列表的对话框,所以如何在对话框中控制这些选项? –

+0

创建您自己的警报对话框,其中将包含可用的选项 – Ares

0

你可以通过

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 
    sharingIntent.setType("text/plain"); 
    List activities = getPackageManager().queryIntentActivities(sharingIntent, 0); 

支持ACTION_SEND安装的应用程序的列表,现在ü可以建立一个自定义对话框只需要通过检查这些应用程序是否在列表中的应用程序。

请在对话框