diff --git a/build.gradle b/build.gradle
index 6356aab..d3ff69d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.0.0'
+ classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/dfu/build.gradle b/dfu/build.gradle
index 922fe41..fbbbbae 100644
--- a/dfu/build.gradle
+++ b/dfu/build.gradle
@@ -7,12 +7,12 @@ ext {
}
android {
- compileSdkVersion 21
+ compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 18
- targetSdkVersion 21
+ targetSdkVersion 22
versionCode 2
versionName "0.6"
}
@@ -26,7 +26,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:support-v4:21.0.3'
+ compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.code.gson:gson:2.3.1'
}
diff --git a/dfu/dfu.iml b/dfu/dfu.iml
index b359374..7763777 100644
--- a/dfu/dfu.iml
+++ b/dfu/dfu.iml
@@ -12,9 +12,9 @@
-
+
-
+
@@ -26,7 +26,7 @@
-
+
@@ -35,12 +35,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -84,11 +84,11 @@
-
+
-
-
+
+
diff --git a/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java b/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
index 689aff0..4803895 100644
--- a/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
+++ b/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
@@ -1838,11 +1838,15 @@ public abstract class DfuBaseService extends IntentService {
final String[] projection = {MediaStore.Images.Media.DISPLAY_NAME};
final Cursor cursor = getContentResolver().query(stream, projection, null, null, null);
- if (cursor.moveToNext()) {
- final String fileName = cursor.getString(0 /* DISPLAY_NAME*/);
+ try {
+ if (cursor.moveToNext()) {
+ final String fileName = cursor.getString(0 /* DISPLAY_NAME*/);
- if (fileName.toLowerCase(Locale.US).endsWith("hex"))
- return new HexInputStream(is, mbrSize);
+ if (fileName.toLowerCase(Locale.US).endsWith("hex"))
+ return new HexInputStream(is, mbrSize);
+ }
+ } finally {
+ cursor.close();
}
return is;
}