Cannot see map in my mobile device

by newbie123 » Tue, 03 Nov 2009 06:42:04 GMT


Sponsored Links
 ello,
THis is my first time deling with MapActivity and I was able to work
the MapView example , go it to compile and launched it on my device,
but I dont see it displaying any maps. It just shows the white screen
with zoom button an d the overlay drawable png image I have. can any
one tell me whats wrong.

Here's my class file MapView class file.

package com.example.hellomap;

import java.util.List;

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

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ZoomControls;


public class mymap extends MapActivity {
List<Overlay> mapOverlays;
Drawable drawable;
mapOverlay itemizedOverlay;
LinearLayout linearLayout;
MapView mapView;
ZoomControls mZoom;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mymap);
linearLayout = (LinearLayout) findViewById(R.id.zoomview);
mapView = (MapView) findViewById(R.id.mapview);
mZoom = (ZoomControls) mapView.getZoomControls();

linearLayout.addView(mZoom);

mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable(R.drawable.man);
itemizedOverlay = new mapOverlay(drawable);

GeoPoint point = new GeoPoint(19240000,-99120000);
OverlayItem overlayitem = new OverlayItem(point, "", "");

itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
}

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

}

Overlay Class file:

package com.example.hellomap;

import java.util.ArrayList;

import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class mapOverlay extends ItemizedOverlay {

private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>
();

public mapOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));
// TODO Auto-generated constructor stub
}


@Override
protected OverlayItem createItem(int arg0) {
return mOverlays.get(arg0);
}

@Override
public int size() {
return mOverlays.size();
}

public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}

}

Manifest File

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellomap"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/
app_name" android:debuggable="true">
<activity android:name=".HelloMap"
android:label=&qu



Cannot see map in my mobile device

by Mike Wolfson » Tue, 03 Nov 2009 07:34:42 GMT


 ithout looking at your code.  You need a key from Google to work with
Maps (and they won't show without it).

Look at the Android Map Tutorial, and it tells you how to obtain the
key (it is free), and then you put the key in your manifest.

Here is a URL to signup as well: http://code.google.com/apis/maps/signup.html

On Nov 1, 5:39pm, newbie123 <abhaysupa...@gmail.com> wrote:

--


Sponsored Links


Cannot see map in my mobile device

by Tim » Fri, 06 Nov 2009 06:45:47 GMT


 


Without reading your code, I'm pretty sure you haven't set your maps
api key appropriately. It goes in the main.xml layout file.

--



Other Threads

1. on the status ba

Hi All:

I have successfully ported wifi on the target device. And it could
work.
But I found the notification icon on the status bar is always the same
icon. It doesn't change status depending on the singal strength of
wireless AP.
Could somebody tell me if it's normal or I should change code to let
it work?

Thanks a lot.

Best Regards,
Morris
--~--~---------~--~----~------------~-------~--~----~

2. SlideME: Looking for Volunteers to Write

Guys,

At SlideME, we are going to be starting up an Android/Mobile news and
articles section. Looking for people with inside connections, technical
people who want to write technical articles, as well as people who want to
review content and/or hardware. One area I'd love to have covered is the
underlying wireless infrastructure (GPRS, proxies, SMS) and how it relates
to Android development.

The focus will be on the mobile developer audience so it's got to be
hard-core writing, no fluff and/or speculation. If you want to write in
languages other than English, that's cool, we can set that up. If
interested, just drop me an e-mail.

This is a community site so just looking for volunteers; this will give you
good visibility as a writer in the mobile space and an avenue for hooking
into the community and getting feedback. If you do content reviews, we will
be pushing them out to SAM, our mobile client, giving you broader
visibility.

Thanks,
Shane

http://slideme.org

--~--~---------~--~----~------------~-------~--~----~

3. Class Cast Exception after classLoader.loadClass() and newInstance!

4. Dynamic Forms UI

5. mediaplayer alsa and opencore , no sound

6. Where can I put the map for gps?

7. Buffer data playing