ユーザーが組み込みのギャラリーから画像を選択できるようにするアプリを実行しています。
これまでのところとても良い..問題は、ジオタグが含まれている写真のみをユーザーに表示する必要があるということです。
つまり、組み込みのギャラリー表示をフィルタリングして、経度と緯度のメタデータを含む画像のみを表示し、携帯電話の他のすべての画像を表示しないようにする必要があります。
簡単な画像ピッカー コードを次に示します。
private void pickPlace()
{
Intent in = new Intent(
Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(in, RESULT_LOAD_IMAGE);
}
//We Get The Selected Image From Gallery And Display It To User..
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();//URI for the picture
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
//Load The Image Into Main Screen
adjustImage(picturePath);
//We get The Coordinates Back to 0
mLongitude = (float) 0.0;
mLatitude = (float) 0.0;
mAddress = "";
}
} catch (NullPointerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
これはうまくいきます。次に、緯度と経度を含む画像のみをフィルタリングして表示する方法を見つける必要があります..他のすべての画像を非表示にします。
ありがとう!