From 9d7ed78e7a981eca109cf745f72c02fac3a4d818 Mon Sep 17 00:00:00 2001 From: Jeff Hamilton Date: Wed, 20 Jul 2011 23:22:00 -0500 Subject: [PATCH] Fix crashes when NFC isn't supported. Change-Id: I638a1e4e5d7a0b5d4f84668e134b13457aeaa879 --- .../com/example/android/apis/nfc/ForegroundDispatch.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/ApiDemos/src/com/example/android/apis/nfc/ForegroundDispatch.java b/samples/ApiDemos/src/com/example/android/apis/nfc/ForegroundDispatch.java index 3fefe0fd8..d6247cbf7 100644 --- a/samples/ApiDemos/src/com/example/android/apis/nfc/ForegroundDispatch.java +++ b/samples/ApiDemos/src/com/example/android/apis/nfc/ForegroundDispatch.java @@ -75,7 +75,8 @@ public class ForegroundDispatch extends Activity { @Override public void onResume() { super.onResume(); - mAdapter.enableForegroundDispatch(this, mPendingIntent, mFilters, mTechLists); + if (mAdapter != null) mAdapter.enableForegroundDispatch(this, mPendingIntent, mFilters, + mTechLists); } @Override @@ -87,7 +88,6 @@ public class ForegroundDispatch extends Activity { @Override public void onPause() { super.onPause(); - //mAdapter.disableForegroundDispatch(this); - throw new RuntimeException("onPause not implemented to fix build"); + if (mAdapter != null) mAdapter.disableForegroundDispatch(this); } }