Issue
For the need of my application, I need a Mapview should act like an ImageView.
The small map that would not have the default behavior (user is not allowed to move it) and I need to launch Google Maps when clicked on it.
I have tried to use code like this:
mapView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("geo:<lat>,<long>?q=<lat>,<long>(Label+Name)"));
startActivity(intent);
}
});
But it seems that the OnClickListener is never called, and I have not found how to disable the mapview scroll.
Thank for any help.
EDIT: I already tried to use clickable=false, taht's a good thing, because the map is now "disabled" and user cannot move it, but I an not able to launch GMaps when clicked...
Solution
When you set clickable(false)
you can't use onClick
, when you set clickable(true)
then onTouch
will take focus. So, override onTouch
and then check inside it if your map view is not clickable, and if it is not clickable => start the activity.
Answered By - Carnal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.