I'm writing a simple android application that should display google maps. The application displays the "Activity is not responding" error upon startup. In the mapdisplay.xml
file where I define the map view activity, I get a "Failed to find style 'mapViewStyle' in current Theme" error message, so I think it's the reason behind the crash.
I have the Internet permission set and the uses-library tag placed correctly in the manifest.
Here is the code listing
public class OnthisdayActivity extends MapActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mapdisplay);
}
@Override
protected boolean isRouteDisplayed()
{
return false;
}
}
And the xml file mapdisplay.xml
<?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"
android:orientation="vertical"
>
<com.google.android.maps.MapView
android:enabled="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mapView"
android:clickable="true"
android:apiKey="xxxxxx"
/>
</RelativeLayout>
And the android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="onthisday.main"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:required="true" android:name="com.google.android.maps"/>
<activity android:name=".OnthisdayActivity"
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>
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…