Reputation: 313
I'm trying to build custom zoom controls for osmdroid. I create button and use zoom-in method as shown here But nothing happens when i click on button. Here is my code:
private MapView map;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Context ctx = getApplicationContext();
Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx));
setContentView(R.layout.activity_main);
map = (MapView) findViewById(R.id.map);
map.setTileSource(TileSourceFactory.MAPNIK);
map.setBuiltInZoomControls(false);
map.setMultiTouchControls(false);
}
public void myClickHandler(View target) {
switch (target.getId()) {
case R.id.button:
map.getController().zoomIn();
break;
}
}
}
Thank you for your response
Upvotes: 1
Views: 1786
Reputation: 3258
You need to wire the click handle to the button
FindViewById (...).setClickListener (...)
Upvotes: 2