Issue
I am trying to create an extended version of MapView
.
The problem is when extended version of MapView
is defined, mapview does not pan.
I am implementing an onTouchListener
Inside my custom map view.
I also want to know is there any methods from where I can pan the mapview.
The problem does not persist when stock version of MapView is used with same source code.
EDIT
MyMapView source:
public class MyMapView extends MapView{
public MyMapView(Context context, String apiKey) {
super(context, apiKey);
}
public MyMapView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyMapView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if(event.getAction()==MotionEvent.ACTION_DOWN){
Log.v("MyMapView","Touched");
}
return false ;
}
}
my onCreate()
from MapActivity
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.mapper);
mMapView=(MyMapView) findViewById(R.id.mapper_map);
mMapView.setSatellite(false);
}
Solution
I was casting it wrong.
mMapView=(MyMapView) findViewById(R.id.mapper_map);
should be
mMapView=(MapView) findViewById(R.id.mapper_map);
This solves the issue.
Thankx anyways.
Answered By - Shardul
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.