I have tried this coding but I get only the grid lines and Google at the bottom in my output. Can anyone please help me for this problem. I am getting unfortunately close when I use fragment, now I am using Map View in the main.
XML
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.maps.MapView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:apiKey="AIzaSyDpO3gdeRI_KgD1-6iTpxNlMy5Btj_pWFw"
android:clickable="true"
android:enabled="true"
android:id="@+id/myGMap"/>
</LinearLayout>
JAVA
public class MainActivity extends MapActivity {
MyLocationOverlay myLocationOverlay;
MapView myMapView = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// extract MapView from layout
myMapView = (MapView) findViewById(R.id.myGMap);
myMapView.setBuiltInZoomControls(true);
// create an overlay that shows our current location
myLocationOverlay = new MyLocationOverlay(this, myMapView);
// add this overlay to the MapView and refresh it
myMapView.getOverlays().add(myLocationOverlay);
myMapView.postInvalidate();
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.map2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
I want to know whether it is depricated. If so how to solve it.
Can anyone explain what does depricated means?
Thanks in advance