tags:

views:

386

answers:

1

Hi guys.

I am trying to make screen with Google Map.

This screen has 2 parts. First part includes Button TextView and ListView and places on the top of Screen. Second part includes MapView (Google map) and places on the bottom of Screen.

How to make it ?

I've done it. But no luck. It throws this exception :

01-07 11:53:12.813: ERROR/AndroidRuntime(725): Uncaught handler: thread main exiting due to uncaught exception 01-07 11:53:12.833: ERROR/AndroidRuntime(725): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mypackagename.uk/com.mypackagename.uk.MyCustomActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.os.Handler.dispatchMessage(Handler.java:99) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.os.Looper.loop(Looper.java:123) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.ActivityThread.main(ActivityThread.java:3948) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at java.lang.reflect.Method.invokeNative(Native Method) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at java.lang.reflect.Method.invoke(Method.java:521) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at dalvik.system.NativeStart.main(Native Method) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.createView(LayoutInflater.java:512) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:564) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.rInflate(LayoutInflater.java:617) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:701) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.rInflate(LayoutInflater.java:613) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.Activity.setContentView(Activity.java:1626) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.mypackagename.uk.MyCustomActivity.onCreate(MyCustomActivity.java:457) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): ... 11 more 01-07 11:53:12.833: ERROR/AndroidRuntime(725): Caused by: java.lang.reflect.InvocationTargetException 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.google.android.maps.MapView.(MapView.java:237) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at java.lang.reflect.Constructor.constructNative(Native Method) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at android.view.LayoutInflater.createView(LayoutInflater.java:499) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): ... 23 more 01-07 11:53:12.833: ERROR/AndroidRuntime(725): Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:180) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.google.android.maps.MapView.(MapView.java:279) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): at com.google.android.maps.MapView.(MapView.java:254) 01-07 11:53:12.833: ERROR/AndroidRuntime(725): ... 27 more

I've the line of code that throws exception: MyCustomActivity.java:457

This line is: setContentView(R.layout.my_layout);

My XML is :

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top|center_vertical">
<com.mypackagename.uk.MyLayout
<TableLayout android:layout_width="fill_parent" 
    android:layout_height="wrap_content">
    <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/my_row1">
        <TableLayout android:layout_width="fill_parent" 
            android:layout_height="wrap_content" android:layout_weight="1">      
            <TableRow android:layout_marginTop="5dip" android:layout_height="wrap_content" android:layout_width="fill_parent">
                <TextView android:layout_height="wrap_content"></TextView>
                <ImageView android:layout_width="wrap_content"></ImageView>
                <TextView android:layout_width="wrap_content"></TextView>
                <TextView android:layout_height="wrap_content" android:layout_width="15px"></TextView>
                <ImageView android:layout_height="wrap_content"></ImageView>
            </TableRow>
        </TableLayout>
    </TableRow>
</TableLayout>
<com.google.android.maps.MapView
    android:id="@+id/map_view_on_yardage"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="my-api-code">
</com.google.android.maps.MapView>
</com.mypackagename.uk.MyLayout>

Please advice.

Thanks.

Edited.

A: 

Guys.

Any suggestion?

AndroiDBeginner