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. just say hello.

just say hello.

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

2. install java for the browser and other apps, and use thinkorswim's mobile version

How do I install java for the browser and other apps, and use
thinkorswim's mobile version?

Using hTC magic.    Trying to go to thinkorswim.com and log in, im
able to log in, and everything else is fine, until I go to certain
area, it says I need to install java.

I cant find much information about doing it on the phone.  When I
contact thinkorswim, they told it requires java running on windows
mobile.    However it seems i requires java only, since java applet is
universal.

Anyone has experience with it?
Or should I find a way to install java on htc magic, i dont know where
to start with this.

Thanks,
Regards.

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

3. SensorEventListener in different thread

4. Youtube account problem on HTC Magic

5. Question about checkbox and gravity in layout

6. Execute a task periodically

7. 绛斿: fillpolygon for Ca nvas?