-1

i have a question about map v2 in a viewpage. when i use map v2 as a normal application (not in a viewpage or something like that) its working wonderfull. as i implemented the map v2 in a viewpage suddenly i had a few bugs i think. first of all the maptype is not the type which i set it in my code. I set for the type:

myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);.

But it displays the normal type (look at the screenshot by pepe at the top of his thread). the second thing is, that i enabled the compass and the myLocationButton but its not displayed too.

myMap.getUiSettings().setCompassEnabled(true); myMap.getUiSettings().setMyLocationButtonEnabled(true);

only the map with the ZoomControlsEnabled-Buttons are displayed. How can i fix that? someone an idea? thanks in advance

Community
  • 1
  • 1
KenMasters
  • 401
  • 3
  • 8
  • 19

1 Answers1

0

yes i fixed it already. i wrote all methods in the fragmentactivtiy.

public class MainActivity extends FragmentActivity implements LocationListener {
....

@Override
protected void onCreate(Bundle arg0) {
    // TODO Auto-generated method stub
    super.onCreate(arg0);
    setContentView(R.layout.main);

    myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
    myMap.getUiSettings().setCompassEnabled(true); 
    myMap.getUiSettings().setMyLocationButtonEnabled(true);


}

......
......
}

public void onLocationChanged(Location location) {

if(location != null) {

        double latitude  = location.getLatitude();
        double longitude = location.getLongitude();

        LatLng latLng = new LatLng(latitude, longitude);

        mapFragment.myMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
        mapFragment.myMap.animateCamera(CameraUpdateFactory.zoomTo(17));

 }

public void onProviderDisabled(String arg0) {
// TODO Auto-generated method stub

}

public void onProviderEnabled(String arg0) {
// TODO Auto-generated method stub

}

public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
// TODO Auto-generated method stub

}   

here are usefull tutorials: tutorial1, tutorial2

KenMasters
  • 401
  • 3
  • 8
  • 19