switch to alsa.omap3 module
[android_pandora.git] / apps / oi-filemanager / FileManager / src / org / openintents / util / IntentUtils.java
1 \r
2 \r
3 /**\r
4  * Original method retrieved from:\r
5  * http://android-developers.blogspot.com/2009/01/can-i-use-this-intent.html\r
6  */\r
7 package org.openintents.util;\r
8 \r
9 import java.util.List;\r
10 \r
11 import android.content.Context;\r
12 import android.content.Intent;\r
13 import android.content.pm.PackageManager;\r
14 import android.content.pm.ResolveInfo;\r
15 \r
16 /**\r
17  * \r
18  * @author romainguy\r
19  * @author Peli\r
20  *\r
21  */\r
22 public class IntentUtils {\r
23         \r
24         /**\r
25          * Indicates whether the specified action can be used as an intent. This\r
26          * method queries the package manager for installed packages that can\r
27          * respond to the specified intent. If no suitable package is\r
28          * found, this method returns false.\r
29          *\r
30          * @param context The application's environment.\r
31          * @param intent The Intent to check for availability.\r
32          *\r
33          * @return True if an Intent with the specified action can be sent and\r
34          *         responded to, false otherwise.\r
35          */\r
36         public static boolean isIntentAvailable(final Context context, final Intent intent) {\r
37             final PackageManager packageManager = context.getPackageManager();\r
38             List<ResolveInfo> list =\r
39                     packageManager.queryIntentActivities(intent,\r
40                             PackageManager.MATCH_DEFAULT_ONLY);\r
41             return list.size() > 0;\r
42         }\r
43 }\r