Issue
Hello and thanks for looking. I am working on my first android app. In one of the tabs I want a functional version of google maps. As you can see, I am well on my way. However I don't know how to zoom in/type in an address for navigation etc with the emulator to see if it is functioning properly.
Here is the layout xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="@+id/myMapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="myapikey"
/>
</LinearLayout>
and the java of my map activity:
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MapsActivity extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maps_layout);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Solution
To turn on zooming you should do the following:
public class MapsActivity extends MapActivity {
private MapView map;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maps_layout);
map = (MapView) findViewById(R.id.map);
map.setBuiltInZoomControls(true);
}
I'm not sure for navigation, the required override for
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
is this and therefore you can't display a route to the searched place.
Answered By - Nikola Davidovic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.