List of usage examples for android.content IntentFilter matchAction
public final boolean matchAction(String action)
From source file:dev.drsoran.moloko.fragments.factories.AbstractIntentFragmentFactory.java
protected final static Fragment resolveIntentToFragment(Context context, Intent intent, List<Class<? extends Fragment>> fragmentClasses) { Fragment fragment = null;/*from w ww . j ava 2s .c om*/ try { for (Iterator<Class<? extends Fragment>> i = fragmentClasses.iterator(); i.hasNext() && fragment == null;) { final Class<? extends Fragment> entry = i.next(); final IntentFilter filter = (IntentFilter) entry.getMethod("getIntentFilter").invoke(null); if (filter.matchAction(intent.getAction()) && filter.matchData(intent.resolveType(context), intent.getScheme(), intent.getData()) > 0) { fragment = DefaultFragmentFactory.create(context, entry, intent.getExtras()); } } } catch (Throwable e) { MolokoApp.Log.e(AbstractIntentFragmentFactory.class, "Unable to instantiate new fragment by Intent " + intent, e); } return fragment; }