Hi,
I followed the steps in document to display MapView. But blank grid is
displayed instead of google map.
My code is below:
public class SMTest extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//get map view
MapView mv = (MapView) findViewById(R.id.my_map);
MapController controller = (MapController)mv.getController();
GeoPoint p = new GeoPoint((int) (24.7 * 1000000),(int)(-238.8
* 1000000));
controller.animateTo(p);
controller.setZoom(9);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
AndroidManifest.xml content:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sm.test"
android:versionCode="1"
android:versionName="1.0.0">
<application android:icon="@drawable/icon" android:label="@string/
app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".SMTest"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-
permission>
</manifest>
main.xml content:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<view class = "com.google.android.maps.MapView"
android:id = "@+id/my_map"
android:apiKey = "0VYn9qrD1aAO-Fex6V2C5mDEmhrSYMlUuMu5orw"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
Do I miss anything?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---