Skip to content

Commit

Permalink
Merge branch 'hotfix/3.9.1' into release/4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Apr 23, 2015
2 parents 9915efb + 16e01b6 commit a91cbd6
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.os.AsyncTask;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
import android.widget.ImageView;

import org.apache.http.HttpEntity;
Expand All @@ -42,13 +43,17 @@ public static int[] getImageSize(Uri uri, Context context){

if (uri.toString().contains("content:")) {
String[] projection = new String[] { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA };
Cursor cur = context.getContentResolver().query(uri, projection, null, null, null);
if (cur != null) {
if (cur.moveToFirst()) {
Cursor cur = null;
try {
cur = context.getContentResolver().query(uri, projection, null, null, null);
if (cur != null && cur.moveToFirst()) {
int dataColumn = cur.getColumnIndex(MediaStore.Images.Media.DATA);
path = cur.getString(dataColumn);
}
cur.close();
} catch (IllegalStateException stateException) {
Log.d(ImageUtils.class.getName(), "IllegalStateException querying content:" + uri);
} finally {
SqlUtils.closeCursor(cur);
}
}

Expand Down Expand Up @@ -406,13 +411,17 @@ public static byte[] createThumbnailFromUri(Context context,
String filePath = null;
if (imageUri.toString().contains("content:")) {
String[] projection = new String[] { MediaStore.Images.Media.DATA };
Cursor cur = context.getContentResolver().query(imageUri, projection, null, null, null);
if (cur != null) {
if (cur.moveToFirst()) {
Cursor cur = null;
try {
cur = context.getContentResolver().query(imageUri, projection, null, null, null);
if (cur != null && cur.moveToFirst()) {
int dataColumn = cur.getColumnIndex(MediaStore.Images.Media.DATA);
filePath = cur.getString(dataColumn);
}
cur.close();
} catch (IllegalStateException stateException) {
Log.d(ImageUtils.class.getName(), "IllegalStateException querying content:" + imageUri);
} finally {
SqlUtils.closeCursor(cur);
}
}

Expand Down

0 comments on commit a91cbd6

Please sign in to comment.