Android :: Overlay Vs ItemizedOverlay?

Oct 24, 2009

I want to draw 20 pins on a MapActivity. Each pin has a small pin image, but I have to dynamically overlay a small bit of text over each pin at runtime.

Looks like I have two options:

#1) Itemized Overlay This is the suggested method. I put all my pins in one ItemizedOverlay object, and that counts as a single Overlay object for my MapView.

#2) One Overlay per pin Create a separate Overlay instance for each pin I need to render.

The problem I see with using method #1 is that you need to set a drawable for the item. This would mean that I need to create 20+20 (one for focused/non-focused state each) bitmaps and keep them in memory for the duration of my app. On the other hand, Overlay lets you override the draw method so I can do the simple compositing at runtime.

The other issue with Itemized Overlay - although it handles focus for you - does it move the focused item to the front of the z-order when selected?


Android :: Performance Of Map Overlay In Conjunction With ItemizedOverlay Very Poor

Apr 14, 2010

I am trying to display one png (drawable) on a map in about 300 points. I am retrieving the coordinates from a Sqlite table, dumping them in a cursor. When I try to display them by parsing through the cursor, it takes for ever for the images to be drawn, about .5 second per image. I find that to be suspiciously slow, so some insight on how I can increase performance would help. Here is the snippet of my code that does the rendering:

while (!mFlavorsCursor.isAfterLast())
point = new GeoPoint(
overlayitem = new OverlayItem(point, "", "");

I tried to isolate all the steps and it looks like the slow one is this: itemizedoverlay.doPopulate(); This is a public method in my class that extends ItemizedOverlay that runs the private populate() method.

View 1 Replies View Related

Android :: Map Open Overlay When Pin Is Clicked - Overlay Contains Description / Button

Aug 18, 2010

I like tu use the MapActivity to display some pins. When a pin is pressed i like to open a description. This can I obtain following the tutorial: /resources /tutorials/views/hello-mapview. But now I like to put a button on the overlay window. That button should open a detail activity. How can I make this? How is possible to personalize the overlay "info window"?

View 2 Replies View Related

Android :: NinePatchDrawable As ItemizedOverlay

Jun 13, 2009

Is it possible to use "stretchable" graphic as pin in ItemizedOverlay? If not how can I draw NinePatchDrawable on Canvas?

View 4 Replies View Related

Android :: ItemizedOverlay ArrayIndexOutOfBoundsException

Jan 31, 2010

I've seen all the posts about using setLastFocusedIndex(-1).

I've tried that but my app is still crashing.


View 2 Replies View Related

Android :: NullPointerException ItemizedOverlay?

Nov 15, 2010

This does not refer to anywhere in my code at all.

How do I go about getting to the bottom of it?


Here is the draw method of the ItemizedOverlay


I now print out the stacktrace and no difference!

View 1 Replies View Related

Android :: Displaying ItemizedOverlay(s) On A Map ?

Oct 31, 2010

I'm having some troubles with displaying ItemizedOverlay(s) on a map.

Here I extracted a simplified example of what I need to do.

Here's my Map class:


I followed the guide provided by google to extends the ItemizedOverlay class


As it is clear from the code I need to update at fixed times a map UI with possibly new positions to do so I'm using a timer, but I think I might fall in some kind of thread issues I don't know how to handle, since when running a test I can see in the Log what happens but no marker is drawn on the map.

View 1 Replies View Related

Android :: Increase Hit Detection On ItemizedOverlay

Sep 23, 2010

I have an itemizedOverlay extended and I want to increase the hit detection on the OverLayItem's if this is possible?

View 1 Replies View Related

Android :: ItemizedOverlay.onTap() Imprecise?

Feb 15, 2010

I'm using Google maps. I put the markers on map and my inherited ItemizedOverlay overrides onTap() method.

Markers are 32x32 images.

However, I can tap quite a bit away from the marker and still receive the event. This becomes a problem when markers are close to each other.

View 2 Replies View Related

Android :: ItemizedOverlay Using Both OnTap Methods

Jun 15, 2010

I have a MapView where I would like to be able to tap the map to create a new item at that location if there is no item there, or display the info about the item if there is.

I tried overriding both the onTap(int) and onTap(GeoPoint, MapView) methods but apparently if the second method is overridden the first never gets called (commenting one or the other lets each one work as I expected).

I thought about just checking if an item was at the location, but there doesn't seem to be any handy methods available to do that (other than iterating through the list of items and checking each manually).

View 17 Replies View Related

Android :: Problem Draw On A MapView ItemizedOverlay

Aug 27, 2010

I am developing an application for the Parisian Metro. One of the functions is a map where you can click the metro stations and see what are the metro lines, and when are the next 4 trains on this station.

I have hence created a MapActivity and an ItemizedOverlay classes.

On my device it is working perfectly, but I am getting some logs from the users with a crash, and I really don't understand what's wrong.

My map activity adds ONE ItemizedOverlay that displays a blue dot for the current user location. This overlay also listens to onTap, which depending on the coordinates of the tap, will try to find metro stations (for which I know the lat/lon coordinates). This is working perfectly.

The stack trace of the crash is:


Sometimes it comes from different lines but it always finishes crashing at

As is does not mention my code, I don't know what's wrong.

You can get the source code of the MapActivity and the the ItemizedOverlay:

The activity class is ACarteStations and the overlay class is StationMetroMapOverlay.

View 1 Replies View Related

Android :: ItemizedOverlay Adding Items And OnTap?

Feb 4, 2010

When I add a new item to my ItemizedOverlay the onTap display I have set appears X times, where X is equal to the number of items that I added. So for example, if I add one item and tap it, it the onTap method gets called once, and in the LogCat I get:

02-04 23:28:56.188: INFO/NotificationService(52): enqueueToast pkg=android.mapit$Stub $Proxy@4394c100 duration=0

If I add a second item and click ANY of the other items, the onTap method gets called twice and I get the following in LogCat:


If I add a third item and click ANY of the other items, the onTap method gets called three times and I get the following in LogCat:


Any idea why this would occur? I'm running into issues with it affecting other things like removal of items.

View 2 Replies View Related

Android :: Access Drawable Resources From ItemizedOverlay?

Jul 3, 2009

I have a method in my ItemizedOverlay class which takes an object as a parameter and depending on it's certain values returns an appropriate icon. What's the best way to access the drawable resource from within ItemizedOverlay as you can't access it directly like in an activity? The only idea I have for now is to pass the resources as a second argument...

View 3 Replies View Related

Android :: MapView With ItemizedOverlay Still Don't Work / Solve It?

Sep 7, 2009

I've try to make a mapview with itemized overlay and it's not work. I share my code if anyone see anything :

java class mapview code...

View 4 Replies View Related

Android :: OnToucheEvent Badly Handles ItemizedOverlay

Jul 6, 2009

I have the following exception that occurs I don't really know in which circumstances.

I'm just trying to add an overlay to may viewMap, and I don't have anything special in my classes. The most strange thing is that it worked for a while, then it broken again when I changed my image!


View 4 Replies View Related

Android : Way To Use 9-patch / Text For ItemizedOverlay On MapView?

Nov 23, 2009

In my application I would like to mark different spots on a map. What I'm now wondering is if there's a way to use a simple 9-patch image and add the spot's name as text to it or would I need to draw everything myself (including the text) in the draw() method of ItemizedOverlay?

View 1 Replies View Related

Android :: How To Persist Options Selected In AlertDialog Spawned From ItemizedOverlay OnTap Method

Jun 7, 2010

In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class.

In my case I've created a class that extends ItemizedOverlay. This class overrides the onTap method and uses an AlertDialog to prompt the user to make a multi-choice selection. I would like to capture and persist the selections for each OverlayItem they tap on.

The below code is the onTap method I've written. It functions as written but doesn't yet do what I'd hope. I'd like to capture and persist each selection made by the user to be used later. How do I do that? Is using an AlertDialog in this manner a good idea? Are there better options?


View 2 Replies View Related

Android :: How To Market Map Overlay?

Sep 21, 2010

I want to market an overlay for Android Maps. It will provide the "speed limit". My map will have to query the internet for updates pretty heavily as one travels. Q: Should I just use the "Maps external Library" thing? or Q: Can I somehow make it an option in the normal google-map system that everyone has on their phone?

View 7 Replies View Related

Android :: Animated Map Overlay

Feb 17, 2009

I am trying to make a map overlay animated much like MyLocationOverlay does. Currently the only things that I can see to make animated are Views but Overlays don't extend View functionality. My next thought was to try to lodge a View into the overlay, but the redundancy makes it seem like this solution is incorrect. I grabbed the android source hoping that I could just look at MyLocationOverlay source and that would let me know how the animation was supposed to be done, but I can't find the source for anything involving maps. If that is available somewhere it would help. Can someone point me to the MyLocationOverlay source or let me know what the paradigm is supposed to look like for animating map overlays?

View 2 Replies View Related

Android :: Activity As Overlay Over Other App

Sep 23, 2009

Is it possible to create an Android activity as an overlay above other application? If yes, please provide me a pointer.

View 7 Replies View Related

Android :: Add Overlay To MapView?

Sep 28, 2010

I have subclassed Overlay as LandMarkOverlay (and implemented an onTap(GeoPoint) method).

In the main activity I do this:


MapView mapView = (MapView) findViewById(;
landmarkOverlay = new LandmarkOverlay();

//add the landmarkOverlay to the list

What else do I need to do so that when the user taps the screen, landmarkOverlay's onTap(GeoPoint) method gets called?

View 1 Replies View Related

Android :: Memory Leak In Map Overlay

Jan 10, 2010

I have been banging away at this one for weeks and I feel like I have exhausted my research capabilities. I am hoping that someone will see my error in the code posted below. The code is completely functional doing everything I need, but there is a major memory leak. When I try to track memory in the DDMS, the VM Heap tells me that my object count is relatively stable and the used memory is also relatively stable (it comes back down to a similar value after each GC after panning).

When I look at the memory pie chart, the free memory loses over 1meg of capacity with each map pan (overlay reload) and the Unknown memory grows. I have not found anything with the allocation tracker. Functional Summary: I load overlays onto a map based on data I get from polling my server. When I pan the map far enough I clear the overlays and load new ones. (snippets): //header info private List<Overlay> overlays;
//in onCreate overlays = mapView.getOverlays();
// here I attempt to fully clean up my old Overlays for (Overlay i : overlays) {
if (i instanceof ParcelOverlay) ((ParcelOverlay) i).cleanUp(); }

View 4 Replies View Related

Android :: Draw Bitmap On Overlay

Nov 12, 2009

I've been trying almost everything and been searching and reading everywhere on the net. I just can't seem to find the correct way of doing this.

I have a MapActivity with a MapView and I want to draw something on an Overlay. I'm overwriting the draw-method, and I can easily draw straight on the canvas using a paint. My problem is I want to merge some circles and afterwards color them. Therefore I want to create a Bitmap and then draw on that. I just don't know what to use. Should I use a mutable Bitmap, a BitmapDrawable or am I simply going in the wrong direction.

The reason I want to do this is because I want to draw some kind of heatmap upon the Google Maps, and I need to merge and blend different circles, so they appear to be just one big blob.

View 6 Replies View Related

Android :: Overlay Image On Imageview

Oct 13, 2010

How to overlay two images like the one in iphone notification icon or new launcher pro notification? I want to add new image on top right of an imageview to show notification.

View 2 Replies View Related

Android :: Is There Anything Like Itemized Overlay For Images?

Nov 18, 2010

I am searching for functionality which works like the itemizedOverlay on the mapview, only for Imageview. So that I can add items on specific locations on the image and trigger actions on tap of the item. I am building an application for Android where you get Floorplans and on this Floorplan the rooms should be marked and clickable to get more information.

View 1 Replies View Related

Android :: Overlay In Bounded Lat Long Possible?

Mar 10, 2010

have been dealing with placement of items in the ItemizedOverlay class with the google maps android library, which seems to work just fine. It handles the icon placments and associated properties of the icons that I place on the viewer.As of lately though, I noticed that I loose the satellite view altogether in the final zoom features of the map when I want to get in real close. I thought this would be a real good opportunity to use a blueprint of an area as an overly on the gridded map so that there were still areas of reference when analyzing an area up close. Unfortunately I have not been able to place a bounded region for the blueprint on the map. If I have latitude and longitude values for each corner of where the blueprint should be places, I can't seem to find a method to put this where I want it on the map.The only constructor/method that I have found only asks for a center point and then sizes the object appropriately. It seems odd that this feature wouldn't exist but I can't find anything to hint that it does exist. JFrog "Debugging is twice as hard as coding something the first time. Therefore, if you make your code as clever as possible, you are by definition, not smart enough to debug it."

View 3 Replies View Related

Android :: Map Overlay Not Updating Unless I Tap Screen

Sep 26, 2010

I have built a simple app that uses a Google MapActivity. On top of the Map, I have 2 overlays, a Marathon Course and the position of a runner. The latter position overlay simply shows an updated blue dot.I update the location of the dot every second but the screen does not refresh. If I tap the scrren then the dot updates. Am I missing some hard refresh call somewhere? My Overlay code is small and shown below. Note that it does go into the draw routine every second and the point is changed.

View 3 Replies View Related

Android :: How To Overlay GLSurfaceView Over A MapView?

May 13, 2010

I want to create a simple Map based application in android ,where i can display my current position.Instead of overlaying a simple Image on the MapView to represent the position, i want to overlay the GLSurfaceView on the MapView. But i don't know how to achieve this. Is there any way to do that?. Please anybody knows the solution help me.

View 1 Replies View Related

Android :: How To Overlay GLSurfaceView Over A CameraPreview?

Sep 22, 2010

I am trying to merge two examples from the ApiDemos so one overlay over the other. 1. 2. I guess GLSurfaceView is not really necessary, I saw demos that uses a GL layer as a Camera PreviewCallback, but since I am such a noob at OpenGL, I am kind of lost. Can someone points me toward the light (figuratively speaking)?

View 1 Replies View Related

Android :: GlSurfaceView With Overlay Using XML / Java

Nov 8, 2010

I started an Android OpenGL application and I have the following classes: class A extends Activity class B extends GlSurfaceView implements Renderer When class A's onCreate is called, it creates an object of type class B and calls: How should I use my custom class that extends glSurfaceView in my XML file/Activity? Code...

View 2 Replies View Related

HTC Incredible :: Battery Percentage Overlay

Sep 11, 2010

No intentions of being redundant, however I ran a search didn't find any new info and I'v been banging my head. I'm farely noobish at root, and I'm currently just running straight up android 2.2 flashed with 3.21 unrEVOked, and everything is working great *cheers to them, great job* I'm just trying to replace my stock battery icon with a new one with percents. I didn't find anything on the forum, perhaps I'm blind.. but just figured I'd see if there was a way to do this yet without installing a rom. I tried one from another site and it put my phone into a force close frenzy and wouldn't load senseui (kept fc'ing) thus making my phone useless. MDA didn't do a nandroid backup, and I royally effed my phone and had to swap back to another incredible. so if anyone has any information, that'd be supa.

View 2 Replies View Related

Android :: Getting Compass Values And Use It On Map Overlay

Sep 13, 2010

I have a marker on the map using an Overlay. I also have access to the compass sensor which I'm able to show a textView with the orientation values (0 to 359). How can I apply this values to the marker? (which is a drawable). I already have a MAtrix created but when I insert the orientation value gives me an error, here it is:

GeoPoint geopoint = new GeoPoint((int) (newLocation.getLatitude() * 1E6),
(int) (newLocation.getLongitude() * 1E6)); Paint paint = new Paint();
Point pt = new Point(); mapView.getProjection().toPixels(geopoint, pt);
Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.user2);
Matrix matrix = new Matrix(); matrix.postTranslate(-25, -25);
matrix.postRotate(direction); matrix.postTranslate(pt.x, pt.y);
paint.setAntiAlias(true); paint.setFilterBitmap(true);
int width = bmp.getWidth(); int height = bmp.getHeight();
Bitmap changedBitmap = Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true);
BitmapDrawable icon = new BitmapDrawable(changedBitmap);
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
userOverlay useroverlay = new userOverlay(icon); useroverlay.addItem(item);

I used the value retrieved from the sensor on "direction" but it doesn't work.

View 5 Replies View Related

Android :: Add An Overlay Of Layout In Listactivity?

May 9, 2010

I am tryin to make a layout appear when even I clich on a row of listactivity. The Overlay layout contains certain function which have to be performed based on the row selected in the list. Can anyone pls suggest me how to do it.

View 1 Replies View Related

Android :: Add A Listener To Image Which In Overlay?

May 20, 2010

I want to add a listener to a image which in the overlay so that dialog will exists after i click the image int the map.

View 2 Replies View Related

Android : Overlay A GLSurfaceview On A Surfaceview?

Apr 27, 2010

Is there anyone who knows how to overlay a GLSurfaceview on a Surfaceview? The Surfaceview is used for the camera preview..

View 4 Replies View Related

Android : How To Show Pop Up On Clicking Map Overlay

Mar 4, 2010

I want to show a custom image with some data in it while clicking map overlay that i have added to google map in android.

Can any one guide me how can i create that custom image or thing to be displayed on google map with some data on it?

some body told me to go for custom view but i have no idea about them.

View 2 Replies View Related

General :: Xperia SP - How To Deactivate HW Overlay

Oct 15, 2013

Can i deactivate hw overlays forever?Every restart I must make it off again. I have a Xperia SP and the front camera and movies don't show a picture when it's on.

View 2 Replies View Related

Overlay Bitmaps With Click Of Button

Oct 27, 2011

I am currently working on an app and I want to lay a Bitmap over the Google Maps bitmap with the click of a button. I am assuming this is possible, and maybe a lot easier than I'm making it.

class MapOverlay extends
public boolean draw(Canvas canvas, MapView mapView,
boolean shadow, long when)

[Code] ......

View 1 Replies View Related

General :: Overlay Folder In CM Build

Mar 30, 2012

What does "overlay" folder do in device/vendor/*DEVICE directory do? How do you make one? What needs to be in it? I am building for a CM7 port.

View 9 Replies View Related

Android :: AR Get Rotation Matrix / Camera Overlay?

Feb 23, 2010

I spend two weeks now trying to get this working with no success. Here is what I want to do: I have several geo points around the user and his phone. I want to display this point overlaying them on the input from the camera (kind of standard AR (Augmented Reality) app). Part of my requirements are that the user can use the phone in either landscape or portrait mode.My plan was like this.
1. Register for Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAGNETIC_FIELD 2. Pass the result to Sensor Manager.getRotationMatrix(), getting back the R matrix that should be telling me how to translate points from the Phone coordinate system (defined here: to World coordinate system (x -> East, y -> North, z -> Sky) 3. I want to translate points from World to Phone so I take the inverse of R (I'm using Matrix.invertM()) to get R_In 4. Using the GPS I translate the geo points I want to display on the camera to points in the World coordinate system and then I run them through the R_In matrix to get their coordinates in the Phone system. 5. Draw the points in the screen only if the have (phone coordinates) z < 0 and x and y such that they are visible. This is my grand plan... however I have problems quite early (2). I do get the R matrix back and it looks good when I align the phone to the world coordinate system ( I get the identity matrix ). However when I try to translate an imaginary point from the Phone coordinate system say (0, 1, 0) to the World coordinate system I don't get the numbers I expect.

View 2 Replies View Related

Android :: Launching Activity From Overlay OnTap

Feb 10, 2009

I am wondering if I am going about this problem the correct way.I am making an app that places overlays on top of google maps.When you click on the overlay it should launch a dialog type window that will give you options on what to do with that overlay.It is the line startActivity where the app throws an exception.I did the setFlags because an error message said it was needed because I was trying to start the Activity while outside an Activity.That makes me think I am going about this wrong.I have 'MyActivity' listed in my manifest so I don't think that is the issue.I have searched for this problem on the internet and I can't seem to find anyone else running into this so that is another reason I think I may be trying to do this the wrong way.

View 3 Replies View Related

Android :: How To Pass Data Without Closing Overlay?

Nov 11, 2010

in my app i am having an Activity that launches another Activity ontop of it. The second Activity is meant to provide controls like next and previous for the first activity.How can i pass button events between the two activities that are visible at the same time without closing the Activity with the controls?

View 2 Replies View Related

Android :: Detecting Long Press On Map Overlay

Aug 13, 2009

I want to be able to detect where a user has long pressed on my Map Overlay.The idea being to get the GeoPoint of the location the user pressed.I can detect where a user taps, but cannot find how to detect a long press.

View 5 Replies View Related

Android :: Way To Persist Graphics On A Canvas (map Overlay)?

Feb 16, 2009

I've been searching around and can't seem to find a way to do this properly. I am doing some tracking where I want to draw dots on a map overlay recording previous positions. When onDraw of the overlay is called it seems the canvas is cleared so I have to redraw all of the history on every invocation. This could result in several thousands of dots being draw over time which seems to not be very efficient. Is there some flag somewhere that I have not found which tells a map overlay to be persistent? Or is there some way I can save and restore the canvas so I'm only maintaining/drawing the current point on each onDraw?

View 4 Replies View Related

Android :: Custom Overlay Item Not Drawing

Aug 10, 2010

I created a custom OverlayItem class so that I could essentially have one kind of OverlayItem whose Drawable marker would set itself depending on the state of some data that I pass into it. I have attempted to accomplish this by, on my first attempt, utilizing the setMarker method within the OverlayItem class. Once that did not work I attempt to override the getMarker method and have it return the appropriate marker to represent the data. Both of these attempts ended with nothing being drawn on the map...however if they are commented out the markers draw just fine (except they of course use the default marker, which isn't what I want). Here is my code for my custom OverlayItem class (the commented out methods I have tried and they have not worked):

private class MyOverlayItem extends OverlayItem {
private Context mContext; private MyData mData;
public MyOverlayItem(GeoPoint point, MyData data, Context context) {
super(point, data.getWhat(), data.getWhere()); this.mContext = context; this.mData = data;
/*if(data.getTemp() > 200) this.setMarker(res.getDrawable(R.drawable.icon_data_hot_l));
else if(data.getTemp() > 100) this.setMarker(res.getDrawable(R.drawable.icon_data_neutral_l));
else this.setMarker(res.getDrawable(R.drawable.icon_data_frozen_l));*/ }
/*@Override public Drawable getMarker(int stateBitset) {
Resources res = this.mContext.getResources(); if(this.mData.getTemp() > 200)
return res.getDrawable(R.drawable.icon_data_hot_l); else if(this.mData.getTemp() > 100)
return res.getDrawable(R.drawable.icon_data_neutral_l);
return res.getDrawable(R.drawable.icon_data_frozen_l);
}*/ }
Is there a way to do what I am attempting to do or do I need to make a unique OverlayItem class corresponding to each state of my data?

View 3 Replies View Related