I'm programming a Map api, but every-time I test it on my tablet, it
FORCE CLOSE. I did the same code as in gloogle help page.

I test 10 different codes, that i found in some sites, but all they
force close.

Just the maps that came with my tablet that works fine.

Is there a specific thing that I have to put on my code to work good?

May tablet its a "Miumiu" design by Ramos.

the maps works fine 20 seconds, 40 seconds sometimes.
but i dont know why the api force close.

Thanks.

Here is my code:

android:apiKey="API-CODE"  -> I put here my api code!!


**************manifest*************

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
package="com.maps.test"
    android:versionCode="1"
    android:versionName="1.0">
    <uses-permission android:name="android.permission.INTERNET" />

    <application android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar">

        <activity android:name=".SysmarineMaps"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

<uses-library android:name="com.google.android.maps" />
    </application>
    <uses-sdk android:minSdkVersion="7" />
</manifest>

*************main************

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_height="fill_parent"
android:layout_width="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="API-CODE"/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="2px">

<ZoomControls android:id="@+id/zoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</FrameLayout>

************Activity**************

package com.map.test;

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

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.GeoPoint;

public class SysmarineMaps extends MapActivity {

private static MapView mapView;
private static MapController mapController;
private static GeoPoint geoPoint;
private static ZoomControls zoomControls;

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        initMap();
        zoomButton();
    }

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

    private void initMap() {

    mapView = (MapView) findViewById(R.id.mapview) ;
        mapView.setClickable(true);
        mapView.setSatellite(true);

        mapController = mapView.getController();

    String coordinates[] = {"-27.571215833", "-48.509360167"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);

geoPoint = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6));

mapController.animateTo(geoPoint);
mapController.setZoom(11);
    }

    private void zoomButton() {

zoomControls = (ZoomControls) findViewById(R.id.zoom);
zoomControls.setIsZoomInEnabled(true);
zoomControls.setIsZoomOutEnabled(true);

        zoomControls.setOnZoomInClickListener(new
View.OnClickListener() {
                @Override
                public void onClick(View v) {
                mapController.zoomIn();
                }
        });

        zoomControls.setOnZoomOutClickListener(new
View.OnClickListener() {
                @Override
                public void onClick(View v) {
                mapController.zoomOut();
                }
        });
    }
}

-- 
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

Reply via email to