How can i declare a LatLng point in my map activity, so that when the users taps on a specific point on the map to place a marker. Now what i have done is to create a map so you can add your custom marker from camera intent ond place on the map. The problem isn't the fact that it works, however the fact that i have to declare a 'point' to the coordinates on a map then when the the image was taken it would place the thumbnail of that image at that point.
example: static final LatLng point = new LatLng(xx.xxxx, xx.xxxx);
and then in my onActivityResult from camera intent:
MarkerOptions markerOptions = new MarkerOptions()
.position(point)
.icon(BitmapDescriptorFactory
.fromBitmap(bitmap));
googleMap.addMarker(markerOptions);
So what i want to do is to listen where the user has tapped and return that image to the point where tapped.
Could someone please help? If you need more info please let me know and will update my question.
Thanks
UPDATED CODE
@Override
public void onMapClick(LatLng point) {
root = Environment.getExternalStorageDirectory().toString()
+ "/Your_Folder";
imageFolderPath = root + "/saved_images";
File imagesFolder = new File(imageFolderPath);
imagesFolder.mkdirs();
imageName = "test.png";
File image = new File(imageFolderPath, imageName);
fileUri = Uri.fromFile(image);
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
startActivityForResult(takePictureIntent,
CAMERA_IMAGE_REQUEST);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data, LatLng point) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
switch (requestCode) {
case CAMERA_IMAGE_REQUEST:
Bitmap bitmap = null;
try {
GetImageThumbnail getImageThumbnail = new GetImageThumbnail();
bitmap = getImageThumbnail.getThumbnail(fileUri, this);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
MarkerOptions markerOptions = new MarkerOptions()
.position(point)
.icon(BitmapDescriptorFactory
.fromBitmap(bitmap));
googleMap.addMarker(markerOptions);
break;
default:
Toast.makeText(this, "Something went wrong...",
Toast.LENGTH_SHORT).show();
break;
}
}
}
public void showFullImage(View view) {
String path = (String) view.getTag();
if (path != null) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri imgUri = Uri.parse("file://" + path);
intent.setDataAndType(imgUri, "image/*");
startActivity(intent);
}