Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should use Fragment. It is like that on layout;</p> <pre><code>&lt;fragment android:name="com.google.android.gms.maps.SupportMapFragment" android:id="@+id/myMapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" /&gt; </code></pre> <p>To use that you should add <strong>google-play-services_lib</strong> project to your project build path. Then in your class you should implement FragmentActivity like that;</p> <pre><code>public class Main extends FragmentActivity{ private GoogleMap mMap; UiSettings settings; MapController mapController; GeoPoint geopoint; RectF oval; Canvas canvas; int mRadius = 5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setUpMap(); } @Override protected void onResume(){ super.onResume(); setUpMap(); } private void setUpMap(){ if (mMap != null) { return; } mMap=((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.myMapView)).getMap(); if (mMap == null) { return; } mMap.setMyLocationEnabled(true); mMap.getUiSettings().setCompassEnabled(true); mMap.getUiSettings().setMyLocationButtonEnabled(true); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(place1, 15)); mMap.setTrafficEnabled(true); mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); } </code></pre> <p>You should obtain an apikey for google maps from this <a href="https://code.google.com/apis/console/" rel="nofollow">link</a> or you can continue step by step from this <a href="https://developers.google.com/maps/documentation/android/start" rel="nofollow">link</a></p> <p>Add your apikey and permissions to Manifest file like that;</p> <pre><code>&lt;uses-permission android:name="your_package.permission.MAPS_RECEIVE"/&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your_api_key"/&gt; </code></pre> <p>Note: meta-data must be inside of <strong>application</strong> in your manifest.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload