Search in sources :

Example 6 with MapFragment

use of com.google.android.gms.maps.MapFragment in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (readyToGo()) {
        setContentView(R.layout.activity_main);
        MapFragment mapFrag = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
        if (savedInstanceState == null) {
            needsInit = true;
        }
        mapFrag.getMapAsync(this);
    }
}
Also used : MapFragment(com.google.android.gms.maps.MapFragment)

Example 7 with MapFragment

use of com.google.android.gms.maps.MapFragment in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (readyToGo()) {
        setContentView(R.layout.activity_main);
        MapFragment mapFrag = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
        if (savedInstanceState == null) {
            needsInit = true;
        }
        mapFrag.getMapAsync(this);
    }
}
Also used : MapFragment(com.google.android.gms.maps.MapFragment)

Example 8 with MapFragment

use of com.google.android.gms.maps.MapFragment in project google-io-2014 by romainguy.

the class DetailActivity method setupMap.

private void setupMap() {
    GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    double lat = getIntent().getDoubleExtra("lat", 37.6329946);
    double lng = getIntent().getDoubleExtra("lng", -122.4938344);
    float zoom = getIntent().getFloatExtra("zoom", 15.0f);
    LatLng position = new LatLng(lat, lng);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(position, zoom));
    map.addMarker(new MarkerOptions().position(position));
}
Also used : MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) GoogleMap(com.google.android.gms.maps.GoogleMap) MapFragment(com.google.android.gms.maps.MapFragment) LatLng(com.google.android.gms.maps.model.LatLng)

Example 9 with MapFragment

use of com.google.android.gms.maps.MapFragment in project coins-android by bubelov.

the class PickLocationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pick_location);
    ButterKnife.bind(this);
    initialLocation = getIntent().getParcelableExtra(LOCATION_EXTRA);
    toolbar.setNavigationOnClickListener(view -> supportFinishAfterTransition());
    toolbar.inflateMenu(R.menu.pick_location);
    toolbar.setOnMenuItemClickListener(item -> {
        if (item.getItemId() == R.id.action_done) {
            Intent data = new Intent();
            data.putExtra(LOCATION_EXTRA, map.getCameraPosition().target);
            setResult(RESULT_OK, data);
            supportFinishAfterTransition();
            return true;
        }
        return false;
    });
    MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}
Also used : MapFragment(com.google.android.gms.maps.MapFragment) Intent(android.content.Intent)

Example 10 with MapFragment

use of com.google.android.gms.maps.MapFragment in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (readyToGo()) {
        setContentView(R.layout.activity_main);
        MapFragment mapFrag = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
        if (savedInstanceState == null) {
            mapFrag.getMapAsync(this);
        }
    }
}
Also used : MapFragment(com.google.android.gms.maps.MapFragment)

Aggregations

MapFragment (com.google.android.gms.maps.MapFragment)16 Intent (android.content.Intent)1 GoogleMap (com.google.android.gms.maps.GoogleMap)1 LatLng (com.google.android.gms.maps.model.LatLng)1 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)1