Hi all,
I've been working religiously through the "Hello Views" tutorials and
all have run ok, except for the MapView tutorial.  I'm stuck on the
first part where you're supposed to run it after adding code for the
zoomControls functionality.

I find that i have two problems that i can't resolve:
1. In the below line from the tutorial code:
linearLayout = (LinearLayout) findViewById(R.id.zoomview);
I get the "Cannot cast from View to LinearLayout" error.

2. The Android 1.5 SDK warns me that the getZoomControls() method is
deprecated.  It would be good if this was updated in the tutorial.
What would be a better way of creating Zoom controls?

I'm running on Eclipse/Vista/Android 1.5

I appreciate any help anyone might have to contribute.

Theo



MY XML FILE LOOKS LIKE:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:id="@+id/mainlayout"
    android:orientation="vertical"
    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:clickable="true"
        android:apiKey="02Wl2gFq1mePgIC07Bg7xM2mw_aTEbcoZmTbdcQ"
    />
        <LinearLayout
            android:id="@+id/zoomview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/mapview"
            android:layout_centerHorizontal="true"
        />
</RelativeLayout>


MY CLASS FILE LOOKS LIKE:
package com.example.hellolinearlayout;

import android.os.Bundle;
import android.widget.ZoomControls;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class HelloMapView extends MapActivity  {
LinearLayout linearLayout;
MapView mapView;
ZoomControls mZoom;

        @Override
                protected void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                         setContentView(R.layout.map);
                linearLayout = (LinearLayout) findViewById(R.id.zoomview);
                mapView = (MapView) findViewById(R.id.mapview);
                mZoom = (ZoomControls) mapView.getZoomControls();

                linearLayout.addView(mZoom);
        }


        @Override
        protected boolean isRouteDisplayed() {
            return false;
        }

}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to