Hi everyone!
I've some problem, while trying the Mapview samples. I don't use
Eclipse or any IDE, just console + notepad. Ofc, I've done any
necessary steps:
1) copy the maps.jar into the projects lib directory
2) Edit the AndroidManifest.xml
a) Grant Internet Access ("android.permission.INTERNET")
b) import com.google.android.maps, which is in the maps.jar
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloandroid">
<application android:label="@string/app_name"
android:icon="@drawable/icon">
<uses-library android:name="com.google.android.maps" />
<activity android:name="com.example.HelloAndroid"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<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" />
</manifest>
--------------------
3) Project target set to "Google Inc.:Google APIs:7", because I want
to try it on a mobile device with Android 2.1
4) Edit the HelloAndroid.java:
package com.example.helloandroid;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.widget.RelativeLayout;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndroid extends MapActivity {
public MapView mapView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
------------------------------
5. Edit the main.xml layout file: (I've also tried with LinearLayout
too)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="*************"
/>
</RelativeLayout>
I've tried many sample codes from Android ebooks, www tutorials, etc.
6. I also have a valid API key.
After these steps, the compiling finished with no(!) errors. But, when
I tried it on a device(Virtual and a real mobile too), I got an error
with "activity has stopped unexpectedly". How can I solve this
problem? Thank's for your help :)
< Peter >
--
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