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. My appwidget broken Donut when keyboard slide out/in

I developed an appwidget and published on market, it works very well
on Cupcake. but after I upgrade my OS to Donut.Everytime when I slide
out/in keyboard, I will got an error:

The process android.process.acore has stopped unexpected.Please try
again.

I have to click "force close", and wait about 3 seconds to get the
home screen. It seems my appwidget cause this error, because after I
uninstall the appwidget, the error also gone. One of my user reported
to me the same problem, he was sure it's my appwidget's problem,
because he erase all application and install one by one to test which
application cause the error, he found after he installed my appwidget,
the error occured again.

It's very strange,I checked Donut documents, seems the appwidget api
have no change.I don't know what happend when keyboard slide out/in,
does any body know why this happen?

below is the log capture from DDMS when the error occured.


10-20 22:50:28.503: DEBUG/AndroidRuntime(764): Shutting down VM

10-20 22:50:28.503: WARN/dalvikvm(764): threadid=3: thread exiting
with uncaught exception (group=0x4001da28)

10-20 22:50:28.523: ERROR/AndroidRuntime(764): Uncaught handler:
thread main exiting due to uncaught exception

10-20 22:50:28.703: ERROR/AndroidRuntime(764):
java.lang.ClassCastException: android.view.AbsSavedState$1

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.launcher.Workspace.onRestoreInstanceState(Workspace.java:
903)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.view.View.dispatchRestoreInstanceState(View.java:5689)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1121)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1125)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1125)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.view.View.restoreHierarchyState(View.java:5668)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState
(PhoneWindow.java:1506)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.app.Activity.onRestoreInstanceState(Activity.java:833)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.launcher.Launcher.finishBindDesktopItems(Launcher.java:
1508)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.launcher.Launcher.bindItems(Launcher.java:1472)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.launcher.Launcher.access$2400(Launcher.java:90)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.launcher.Launcher$DesktopBinder.handleMessage
(Launcher.java:2225)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.os.Handler.dispatchMessage(Handler.java:99)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.os.Looper.loop(Looper.java:123)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
android.app.ActivityThread.main(ActivityThread.java:4203)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
java.lang.reflect.Method.invokeNative(Native Method)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
java.lang.reflect.Method.invoke(Method.java:521)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:791)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)

10-20 22:50:28.703: ERROR/AndroidRuntime(764):     at
dalvik.system.NativeStart.main(Native Method)

10-20 22:50:28.713: INFO/Process(81): Sending signal. PID: 764 SIG: 3

10-20 22:50:28.713: INFO/dalvikvm(764): threadid=7: reacting to signal
3

10-20 22:50:28.963: INFO/dalvikvm(764): Wrote stack trace to '/data/
anr/traces.txt'

10-20 22:50:29.313: INFO/DumpStateReceiver(81): Added state dump to 1
crashes

10-20 22:50:31.003: DEBUG/dalvikvm(81): GC freed 10815 objects /
597576 bytes in 274ms
--~--~---------~--~----~------------~-------~--~----~

2. Google Streetview for 2.0 emulator, to test invocation through an Intent

My apps invoke Google Streetview through an Intent (as document here:
http://developer.android.com/intl/zh-TW/guide/appendix/g-app-intents.html).
Right now I am testing things out for Android 2.0. In the absence of a
physical device, this is through emulator testing only, for now.
I noticed the Google apps, which are needed to test the above, are
missing in  2.0. I did some poking around but couldn't find a source
to install those on the emulator (I am aware there's been some
commotion around that aspect of Android...). So I tried the Cyanogen
(sp?) route, pull Street.apk off a 1.6 device and then adb install it
in the emulator. That didn't work... Street.apk is reported as already
existing, and I cannot replace it ("failure").
BTW: I cross checked this method against Maps.apk, and that went
through OK.

Anybody got an idea how to properly install street view on the 2.0
emulator? (Did I fundamentally miss something here?)

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

3. Eclais SDK is out, but STILL no Arabic support in Android

4. Turn copy protection from on to off on market app?

5. Run ARM application on Qualcomm 3G

6. Slashdot: Android / Windows 7 Dual Boot Netbook Disappoints

7. Using TransitionDrawable to make a transition with 3 elements