use of com.google.android.maps.MapView in project GreenDroid by cyrilmottier.
the class MapPinMapActivity method onCreate.
//@formatter:on
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarContentView(R.layout.map_pin);
final MapView mapView = (MapView) findViewById(R.id.map_view);
mapView.setBuiltInZoomControls(true);
final Resources r = getResources();
for (int i = 0; i < sAreas.length; i++) {
final OverlayItem[] items = sAreas[i];
ColorStateList pinCsl = createRandomColorStateList();
ColorStateList dotCsl = createRandomColorStateList();
BasicItemizedOverlay itemizedOverlay = new BasicItemizedOverlay(new MapPinDrawable(r, pinCsl, dotCsl));
for (int j = 0; j < items.length; j++) {
itemizedOverlay.addOverlay(items[j]);
}
mapView.getOverlays().add(itemizedOverlay);
}
}
use of com.google.android.maps.MapView in project android-support-v4-googlemaps by petedoyle.
the class FragmentLayout method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_layout);
// Check to see if we have a frame in which to embed the details
// fragment directly in the containing UI.
View detailsFrame = findViewById(R.id.details);
boolean dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;
// Decide where to place TitlesFragment.
// See fragment_layout.xml in res/layout/ and res/layout-land/ to see the difference
int targetLayout = dualPane ? R.id.titles : R.id.main;
// do not add to backstack, or user will be able to press back and
// view the blank layout with nothing in it (a blank screen).
// In this case, we want the back button to exit the app.
getSupportFragmentManager().beginTransaction().add(targetLayout, TitlesFragment.newInstance(dualPane)).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
mMapViewContainer = LayoutInflater.from(this).inflate(R.layout.mapview, null);
mMapView = (MapView) mMapViewContainer.findViewById(R.id.map);
//TODO: There's still a bug. To reproduce:
// 1) Start app in portrait mode.
// 2) Flip to landscape.
// 3) Flip back to portrait.
// 4) Select an item (item displays fine)
// 5) Press back
// 6) Select another item
// RESULT: Both the details and list view display on top of each other
// EXPECTED: The details should show without the list
}
use of com.google.android.maps.MapView in project cw-android by commonsguy.
the class MapFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
map = new MapView(getActivity(), "0mjl6OufrY-tHs6WFurtL7rsYyEMpdEqBCbyjXg");
map.setClickable(true);
map.getController().setCenter(getPoint(40.76793169992044, -73.98180484771729));
map.getController().setZoom(17);
map.setBuiltInZoomControls(true);
Drawable marker = getResources().getDrawable(R.drawable.marker);
marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight());
map.getOverlays().add(new SitesOverlay(marker));
me = new MyLocationOverlay(getActivity(), map);
map.getOverlays().add(me);
((ViewGroup) getView()).addView(map);
}
use of com.google.android.maps.MapView in project robolectric by robolectric.
the class ShadowMapViewTest method setUp.
@Before
public void setUp() throws Exception {
mapView = new MapView(new Activity(), "foo");
overlay1 = new MyOverlay(null);
overlay2 = new MyOverlay(null);
mapTouchListener = new MyOnTouchListener();
mapView.getOverlays().add(overlay1);
mapView.getOverlays().add(overlay2);
mapView.setOnTouchListener(mapTouchListener);
sourceEvent = MotionEvent.obtain(0, 0, 0, 0, 0, 0);
}
use of com.google.android.maps.MapView in project robolectric by robolectric.
the class ShadowMapViewTest method initMapForDrag.
private void initMapForDrag() {
mapView = new MapView(RuntimeEnvironment.application, "");
mapView.layout(0, 0, 50, 50);
mapView.getController().setCenter(new GeoPoint(toE6(25), toE6(25)));
mapView.getController().zoomToSpan(toE6(50), toE6(50));
}
Aggregations