List of usage examples for android.content IntentFilter matchData
public final int matchData(String type, String scheme, Uri data)
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 w w. j ava 2 s .c o m 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; }