Skip to content

Commit

Permalink
Catching unknown URL exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyr59h committed Apr 22, 2015
1 parent 8821cb2 commit 21508f3
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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 Down Expand Up @@ -405,13 +406,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()) {
int dataColumn = cur.getColumnIndex(MediaStore.Images.Media.DATA);
filePath = cur.getString(dataColumn);
try {
Cursor cur = context.getContentResolver().query(imageUri, projection, null, null, null);
if (cur != null) {
if (cur.moveToFirst()) {
int dataColumn = cur.getColumnIndex(MediaStore.Images.Media.DATA);
filePath = cur.getString(dataColumn);
}
cur.close();
}
cur.close();
} catch (IllegalStateException stateException) {
Log.d(ImageUtils.class.getName(), "IllegalStateException querying content:" + imageUri);
}
}

Expand Down

0 comments on commit 21508f3

Please sign in to comment.