Itemized overlay

by sweet » Wed, 02 Sep 2009 15:09:37 GMT


Sponsored Links
 've a problem with ItemizedOverlay in a mapView.
I had folow the tuto HelloMapView in the android developpers website
and i can't display the itemized overlay in the bottom of the tuto.
I show you my code:

mapview java:

import java.util.List;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.ZoomControls;

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


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


@Override
public void onCreate(Bundle savedInstanceState) {

GeoPoint point = new GeoPoint(19240000,-99120000);
OverlayItem overlayitem = new OverlayItem(point, "", "");
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable
(R.drawable.androidmarker);
itemizedOverlay = new ItemizedOverlay(drawable);

super.onCreate(savedInstanceState);
setContentView(R.layout.map);
linearLayout = (LinearLayout) findViewById(R.id.zoomview);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setSatellite(true);
}
protected boolean isRouteDisplayed() {
return false;
}
}

ItemizedOverlay Java:

import android.graphics.drawable.Drawable;
import java.util.ArrayList;

import com.google.android.maps.OverlayItem;

public class ItemizedOverlay extends
com.google.android.maps.ItemizedOverlay {

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

public ItemizedOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));

}

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

@Override
public int size() {
return mOverlays.size();
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}

}

map XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
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="0GWRUwsy0_POHxdWofVfhZeFLwtgkcn7ouMfwcg"/>
<LinearLayout
android:id="@+id/zoomview"
android:layout



Itemized overlay

by ragavendran s » Wed, 02 Sep 2009 15:20:56 GMT


 irst Step :hello Sweet first u ensure that u r marker image is placed in
the res/drawable

Second Step:Then U extend ur (HelloItemized Overlay)ItemizedOverlay class
extends with ItemizedOverlay

Third Step: try to Change ur Geo Point(It Should be Between the Range)

On Wed, Sep 2, 2009 at 12:31 PM, sweet <junkybr...@gmail.com> wrote:


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


Sponsored Links


Itemized overlay

by 浜庢磱 » Wed, 02 Sep 2009 16:09:13 GMT


 009/9/2 sweet <junkybr...@gmail.com>

and add :<uses-library android:name="com.google.android.maps"/> between
<activity> and <application> in mainifest!

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



Itemized overlay

by andrehbleitao » Thu, 03 Sep 2009 01:10:11 GMT


 t isn't a NullPointerException??

public void onCreate(Bundle savedInstanceState) {

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

itemizedOverlay.addOverlay(overlayitem); //NULL
REFERENCE HERE
...
}

You are trying to call a method in a null reference. This may solve
the problem:

public void onCreate(Bundle savedInstanceState) {

GeoPoint point = new GeoPoint(19240000,-99120000);
OverlayItem overlayitem = new OverlayItem(point, "",
"");
drawable = this.getResources().getDrawable
(R.drawable.androidmarker);
itemizedOverlay = new ItemizedOverlay(drawable);
itemizedOverlay.addOverlay(overlayitem); //NULL
REFERENCE HERE
...
}


=D

On 2 set, 04:01, sweet <junkybr...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Itemized overlay

by sweet » Thu, 03 Sep 2009 01:45:53 GMT


 ello ragavendran s and  thank for your answers.
My marker image is well in the res/drawable, my geopoint is Mexico gps
coordonates (like the tuto) and the library of maps was already put in
my Manifest.
I've done what you says ragavendran s in my ItemizedOverlay class
(which i rename to NewItemizedOverlay):

import java.util.ArrayList;

import android.graphics.drawable.Drawable;

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

@SuppressWarnings("unchecked")
public class NewItemizedOverlay extends ItemizedOverlay {

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

public NewItemizedOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));
// TODO Auto-generated constructor stub
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}

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


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

}

But i've always an error. I think the mistake is in the fourth step of
the tuto (http://developer.android.com/intl/fr/guide/tutorials/views/
hello-mapview.html) in the last part:

4. All that's left is for us to add this OverlayItem to our collection
in the HelloItemizedOverlay, and add this to the List of Overlay
objects retrieved from the MapView:

itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);

i can't add this to the List of Overlay objects retrieved from the
MapView. How i can do that ?

Thanks
Sweet

On 2 sep, 10:08, <yuyang3...@gmail.com> wrote:

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



Itemized overlay

by sweet » Thu, 03 Sep 2009 23:10:29 GMT


  don't understand your correction andrehbleitao...
In the tuto i don'tunderstand the step 4 in the last part. I think i
should understand this and make what it said for my application work
well isn't it ?

On 2 sep, 10:43, sweet <brou...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. javax.xml.datatype.XMLGregorianCalendar

An external library that I use (Sesame) references the method
javax.xml.datatype.XMLGregorianCalendar.toXMLFormat, which is not
available in Android. What can I do about that? The complete error is
this:

E/ActivityThread( 1811): Failed to find provider info for
com.google.settings
W/dalvikvm( 1811): VFY: unable to find class referenced in signature
(Ljavax/xml/datatype/XMLGregorianCalendar;)
E/dalvikvm( 1811): Could not find method
javax.xml.datatype.XMLGregorianCalendar.toXMLFormat, referenced from
method org.openrdf.model.impl.ValueFactoryBase.createLiteral
W/dalvikvm( 1811): VFY: unable to resolve virtual method 2047: Ljavax/
xml/datatype/XMLGregorianCalendar;.toXMLFormat ()Ljava/lang/String;
W/dalvikvm( 1811): VFY:  rejecting opcode 0x6e at 0x0000
W/dalvikvm( 1811): VFY:  rejected Lorg/openrdf/model/impl/
ValueFactoryBase;.createLiteral (Ljavax/xml/datatype/
XMLGregorianCalendar;)Lorg/openrdf/model/Literal;
W/dalvikvm( 1811): Verifier rejected class Lorg/openrdf/model/impl/
ValueFactoryBase;
D/AndroidRuntime( 1811): Shutting down VM
W/dalvikvm( 1811): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime( 1811): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 1811): java.lang.VerifyError:
org.openrdf.model.impl.ValueFactoryBase
E/AndroidRuntime( 1811):        at org.openrdf.http.client.HTTPClient.<init>
(HTTPClient.java:133)
E/AndroidRuntime( 1811):        at
org.openrdf.repository.http.HTTPRepository.<init>(HTTPRepository.java:
56)
E/AndroidRuntime( 1811):        at
org.openrdf.repository.http.HTTPRepository.<init>(HTTPRepository.java:
61)
E/AndroidRuntime( 1811):        at com.test.TestActivity.onCreate
(TestActivity.java:27)
E/AndroidRuntime( 1811):        at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1123)
E/AndroidRuntime( 1811):        at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2231)
E/AndroidRuntime( 1811):        at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2284)
E/AndroidRuntime( 1811):        at android.app.ActivityThread.access$1800
(ActivityThread.java:112)
E/AndroidRuntime( 1811):        at android.app.ActivityThread$H.handleMessage
(ActivityThread.java:1692)
E/AndroidRuntime( 1811):        at android.os.Handler.dispatchMessage
(Handler.java:99)
E/AndroidRuntime( 1811):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1811):        at android.app.ActivityThread.main
(ActivityThread.java:3948)
E/AndroidRuntime( 1811):        at java.lang.reflect.Method.invokeNative
(Native Method)
E/AndroidRuntime( 1811):        at java.lang.reflect.Method.invoke
(Method.java:521)
E/AndroidRuntime( 1811):        at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 1811):        at com.android.internal.os.ZygoteInit.main
(ZygoteInit.java:540)
E/AndroidRuntime( 1811):        at dalvik.system.NativeStart.main(Native
Method)
--~--~---------~--~----~------------~-------~--~----~

2. display more than one activity window on device

Hi,

We are trying to modify android to display more than one activity window
simultaneously. Does anyone know what e need to change in the android source
code to enable this? How huge of a change will this be?

thanks
Amish

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

3. Making a persistant content observer

4. App Test Group - Progress

5. screen Y position not changing after soft keyboard pushes window up.

6. Android/Davlik as Real Time OS?

7. Possibility Of Deactivate Camera?