mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
try catch block, works on real device
This commit is contained in:
parent
6d914148e6
commit
81156db89f
1 changed files with 16 additions and 9 deletions
|
|
@ -168,14 +168,21 @@ public class ShareActivity
|
||||||
|
|
||||||
|
|
||||||
private String getRealPathFromURI(Uri contentUri) {
|
private String getRealPathFromURI(Uri contentUri) {
|
||||||
String[] proj = { MediaStore.Images.Media.DATA };
|
Cursor cursor = null;
|
||||||
Cursor cursor = getContentResolver().query(contentUri, proj, null, null, null);
|
try {
|
||||||
|
String[] proj = {MediaStore.Images.Media.DATA};
|
||||||
|
cursor = getContentResolver().query(contentUri, proj, null, null, null);
|
||||||
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
|
return cursor.getString(column_index);
|
||||||
String cursorString = cursor.getString(column_index);
|
} catch (Exception e) {
|
||||||
//cursor.close();
|
Log.w(TAG, e);
|
||||||
return cursorString;
|
return "";
|
||||||
|
} finally {
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -210,7 +217,7 @@ public class ShareActivity
|
||||||
Log.d(TAG, "Filepath: " + filePath);
|
Log.d(TAG, "Filepath: " + filePath);
|
||||||
|
|
||||||
|
|
||||||
if (filePath != null) {
|
if (filePath != null && !filePath.equals("")) {
|
||||||
//extract the coordinates of image in decimal degrees
|
//extract the coordinates of image in decimal degrees
|
||||||
Log.d(TAG, "Calling GPSExtractor");
|
Log.d(TAG, "Calling GPSExtractor");
|
||||||
GPSExtractor imageObj = new GPSExtractor(filePath);
|
GPSExtractor imageObj = new GPSExtractor(filePath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue