android.content.IntentFilter.MalformedMimeTypeException Java Examples
The following examples show how to use
android.content.IntentFilter.MalformedMimeTypeException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddCrossProfileIntentFilterFragment.java From android-testdpc with Apache License 2.0 | 6 votes |
/** * Constructs an intent filter from user input. This intent-filter is used for cross-profile * intent. * * @return a user constructed intent filter. */ private IntentFilter getIntentFilter() { if (mActions.isEmpty() && mCategories.isEmpty() && mDataSchemes.isEmpty() && mDataTypes.isEmpty()) { return null; } IntentFilter intentFilter = new IntentFilter(); for (String action : mActions) { intentFilter.addAction(action); } for (String category : mCategories) { intentFilter.addCategory(category); } for (String dataScheme : mDataSchemes) { intentFilter.addDataScheme(dataScheme); } for (String dataType : mDataTypes) { try { intentFilter.addDataType(dataType); } catch (MalformedMimeTypeException e) { Log.e(TAG, "Malformed mime type: " + e); return null; } } return intentFilter; }
Example #2
Source File: ZannenNfcWriter.java From effective_android_sample with Apache License 2.0 | 6 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); setContentView(R.layout.main); findViewById(R.id.write_tag).setOnClickListener(mTagWriter); // Handle all of our received NFC intents in this activity. mNfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); // Intent filters for reading a note from a tag or exchanging over p2p. IntentFilter ndefDetected = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { ndefDetected.addDataType("text/plain"); } catch (MalformedMimeTypeException e) { } mNdefExchangeFilters = new IntentFilter[] { ndefDetected }; // Intent filters for writing to a tag IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); mWriteTagFilters = new IntentFilter[] { tagDetected }; }
Example #3
Source File: EventsBus.java From deprecated-event-bus with Apache License 2.0 | 6 votes |
/** * @return Registration id to use in unregister(regId) method */ public static synchronized int register(String receiverId, EventsListener listener) { check(); if (listener == null) throw new NullPointerException("Listener cannot be null"); EventsReceiver receiver = new EventsReceiver(); receiver.mReceiverId = receiverId; receiver.mListener = listener; try { sAppContext.registerReceiver(receiver, new IntentFilter(sIntentAction, BASE_MIME_TYPE + "/*")); } catch (MalformedMimeTypeException e) { e.printStackTrace(); } sReceiversMap.put(++sRegistrationId, receiver); for (Intent sticky : sStickyEventsMap.values()) { receiver.onReceive(sAppContext, sticky); } return sRegistrationId; }
Example #4
Source File: SampleMediaRouteProvider.java From media-samples with Apache License 2.0 | 5 votes |
private static void addDataTypeUnchecked(IntentFilter filter, String type) { try { filter.addDataType(type); } catch (MalformedMimeTypeException ex) { throw new RuntimeException(ex); } }
Example #5
Source File: SampleMediaRouteProvider.java From android-MediaRouter with Apache License 2.0 | 5 votes |
private static void addDataTypeUnchecked(IntentFilter filter, String type) { try { filter.addDataType(type); } catch (MalformedMimeTypeException ex) { throw new RuntimeException(ex); } }
Example #6
Source File: SampleMediaRouteProvider.java From V.FlyoutTest with MIT License | 5 votes |
private static void addDataTypeUnchecked(IntentFilter filter, String type) { try { filter.addDataType(type); } catch (MalformedMimeTypeException ex) { throw new RuntimeException(ex); } }
Example #7
Source File: BaseRunner.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
public IntentFilter buildFilter() { Log.i(TAG, "buildFilter()"); IntentFilter filter = new IntentFilter(DispatchResponseReceiver.BROADCAST_RESPONSE); filter.addDataScheme(Encounters.CONTENT_URI.getScheme()); try { filter.addDataType(Encounters.CONTENT_ITEM_TYPE); } catch (MalformedMimeTypeException e) { } return filter; }
Example #8
Source File: EncounterTaskList.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
public IntentFilter buildFilter() { IntentFilter filter = new IntentFilter(Response.RESPONSE); try { filter.addDataType(EncounterTasks.CONTENT_TYPE); filter.addDataType(EncounterTasks.CONTENT_ITEM_TYPE); filter.addDataType(Subjects.CONTENT_TYPE); } catch (MalformedMimeTypeException e) { } return filter; }
Example #9
Source File: NFCHandler.java From timelapse-sony with GNU General Public License v3.0 | 5 votes |
public static IntentFilter[] getIntentFilterArray() { IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { ndef.addDataType(SONY_MIME_TYPE); } catch (MalformedMimeTypeException e) { throw new RuntimeException("fail", e); } return new IntentFilter[]{ndef}; }
Example #10
Source File: ForegroundDispatch.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override public void onCreate(Bundle savedState) { super.onCreate(savedState); setContentView(R.layout.foreground_dispatch); mText = (TextView) findViewById(R.id.text); mText.setText("Scan a tag"); mAdapter = NfcAdapter.getDefaultAdapter(this); // Create a generic PendingIntent that will be deliver to this activity. The NFC stack // will fill in the intent with the details of the discovered tag before delivering to // this activity. mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); // Setup an intent filter for all MIME based dispatches IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { ndef.addDataType("*/*"); } catch (MalformedMimeTypeException e) { throw new RuntimeException("fail", e); } mFilters = new IntentFilter[] { ndef, }; // Setup a tech list for all NfcF tags mTechLists = new String[][] { new String[] { NfcF.class.getName() } }; }