views:

44

answers:

1

My Map activity crashes on launch. I have included all the permission and also tested on a new standalone map project where it worked perfectly well with the underlying code.

Rather when I incorporate the same code in my application, it crashes as soon as this activity is invoked. I have a project submission tomorrow morning, so please reply asap

My map activity is as follows

            package com.healthcare.iFind;

            import com.google.android.maps.MapActivity;
            import com.google.android.maps.MapView;
            import com.google.android.maps.MapView.LayoutParams;

            import android.os.Bundle;
            import android.view.View;
            import android.widget.LinearLayout;

            public class MapsActivity extends MapActivity
            {
            MapView mapView;

            /** Called when the activity is first created. */
            @Override
            public void onCreate(Bundle savedInstanceState)
            {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.maps);


            mapView = (MapView) findViewById(R.id.mapView);
            LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
            View zoomView = mapView.getZoomControls();

            zoomLayout.addView(zoomView,
            new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT));
            mapView.displayZoomControls(true);

            }

            @Override
            protected boolean isRouteDisplayed() {
            // TODO Auto-generated method stub
            return false;
            }
            }

My AndroidManifest.xml file:

            <?xml version="1.0" encoding="utf-8"?>
            <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.healthcare.iFind"
            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=".HomeScreen"
            android:label="@string/app_name">
            <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            </activity>
            <activity android:name="MessageList"></activity>
            <activity android:name="RateDoctor"></activity>
            <activity android:name="RateQuiz"></activity>
            <activity android:name="DetailedDoctor"></activity>
            <activity android:name="DoctorProfile"></activity>
            <activity android:name=".MapsActivity"/>
            </application>

My maplayout.xml file.

            </manifest>

            <?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:enabled="true"
            android:clickable="true"
            android:apiKey="mykey"
            />
            <LinearLayout android:id="@+id/zoom"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            />

            </RelativeLayout>
A: 

alt text

Right next to the red line, does your workspace look like that. Just to make sure you are compiling over the API and not the regular 2.2 package.

This code runs just fine on my emulator. (2.2 using googles API)

Just in case, change:

<activity android:name=".MapsActivity"/>

into

<activity android:name=".MapsActivity"/></activity>

It shouldnt do much of a diference, but just to keep consistency in your manifest.

blindstuff
I have everything exactly as you said, looks like something is wrong with my emulator. But isnt this error propping up weird ?: Lcom/healthcare/iFind/MapsActivity
standroid
Post more info from the logcat, doesnt it at least give a line where its crashing. Copy the whole logCat error into your original question.You could just try to delete that AVD, and create a new one.
blindstuff
I created a new AVD but the problem still persists. Here is the error in the Logcat: http://fpaste.org/B3fX/
standroid