summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeter Rustler <peter.rustler@basyskom.com>2015-01-14 15:42:20 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-02-02 08:01:42 +0000
commit48ad3a42f841f00ea5bca835597a3cc0c80df5b4 (patch)
tree6000038f74ab617c67183424f48e4d290d434d3e /src
parent454fb59a5146b4b27756c7787e80681167819a63 (diff)
Add exception handling to enableForegroundDispatch
If the activity is not in foreground the call to enableForegroundDispatch can throw an exception. Exception handling is added in this patch. Change-Id: Id9adbf25de4840679f0c4754c136f6195527c0f3 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java b/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java
index c52f3258..2e6cb959 100644
--- a/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java
+++ b/src/android/nfc/src/org/qtproject/qt5/android/nfc/QtNfc.java
@@ -104,7 +104,11 @@ public class QtNfc
m_activity.runOnUiThread(new Runnable() {
public void run() {
//Log.d(TAG, "Enabling NFC");
- m_adapter.enableForegroundDispatch(m_activity, m_pendingIntent, null, null);
+ try {
+ m_adapter.enableForegroundDispatch(m_activity, m_pendingIntent, null, null);
+ } catch(IllegalStateException e) {
+ throw new RuntimeException("Fail", e);
+ }
}
});
}