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).

Android :: ItemizedOverlay using both onTap methods


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 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 callback=android.app.ITransientNotification$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:

CODE:.....................

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:

CODE:...................................

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 :: 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?

CODE:.......................

View 2 Replies View Related

Android :: When Do Synchronize Methods Or Use Synchronized Blocks In Methods In Android Game

Mar 14, 2010

I'm looking into writing simple graphics code in Android and I've noticed some synchronized() blocks. What is the reasoning behind this and how do I know when I should be "synchronizing" my code?

View 1 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.

CODE:...............

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?

CODE:..........................

Here is the draw method of the ItemizedOverlay

CODE:..........................

I now print out the stacktrace and no difference!

View 1 Replies View Related

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?

View 2 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:

CDE:........

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

CODE:...................

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 :: Change Drawable OnTap?

Aug 3, 2010

I have an Overlays class named picOverlay which extends ItemizedOverlay<OverlayItem> that uses a drawable named ''overlay''.

I'd like for my application to change the drawable to let's say ''overlay_hover'' when the user touches the overlay.

Can I do this in the onTap method? Can someone enlight me a little bit on how to change the drawable that I'm actually touching?

View 2 Replies View Related

Android :: OnTap Start Dialog?

Aug 28, 2009

I have a mapactivity with multiple ItemizedOverlays and a onTap method when the user clicks on the marker. I can show a toast message but i want to display a Dialog when the user clicks on the marker (so in onTap method). How can i do that?

View 2 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 :: 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 :: Starting Activity In Overlay OnTap?

Feb 10, 2009

I am attempting to launch a dialog type window when I click an Overlay that has been placed on google maps. I thought the way I would do this was Override the onTap() method, create an intent, and call startActivity on that intent as follows:

CODE:..........

It looks like the program throws an ActivityNotFoundException when executing that last line. The exception reads that if you try to start an Activity while you are not in an Activity you need to set the FLAG_ACTIVITY_NEW_TASK flag which is why that line is there. I have included MyActivity in my manifest.

'context' is passed to my class constructor that extends Overlay and is the MapActivity that I am using to display the map.

View 2 Replies View Related

Android :: OnTap Display Toast Or Message

Jul 13, 2009

I looked for any information about onTap event processing for itemized overlays in this group. There is a lot of useful information but I could not find the answer to one question.

The tutorial by Mark Murphy on itemized overlays, http://androidguys.com/?p=1413

describes how to generate a Toast message whenever an onTap event occurs. In his case, the custom itemized overlay activity is included in the main activity. In my case, it is not. My custom itemized overlay activity is included in the application package as a public activity.

This means that the line Toast.makeText(NooYawk.this, items.get(i).getSnippet(), Toast.LENGTH_SHORT).show(); will not work "as is".

I have had trouble in correctly identifying the context for the Toast. Attempts to use the main class' (the one calling the custom itemized overlay class) context have not worked. I would appreciate it if anyone could suggest how I could resolve this issue. Incorporating the custom itemized overlay class in the main class is not a desirable option.

Alternatively, I would appreciate any suggestions for generating a display of the title and/or snippet information for markers on a map.

The onTap event works fine (Log.i statements in the onTap method display the correct information for each marker tapped)

View 7 Replies View Related

Android : Show Popup In MapLocationOverlay.onTap?

Oct 12, 2010

I'm trying to display a popup in a MapView. I m doing this in myLocationOverlay.onTap() method. I got the initial popup to display correctly. I have a button in the popup to expand the popup by making some hidden view visible and changing the height of the popup like this..

but the height of the popup doesn't seems to change. Am I missing something here?

View 2 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:

CODE:.....................

Sometimes it comes from different lines but it always finishes crashing at OverlayBunde.java:42

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: http://code.google.com/p/metroparis/source/browse/trunk/src/org/bicou/metro/

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

View 1 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!

CODE:............................

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 :: Overlay OnTap Not Working After Back Button?

Jul 29, 2010

I have several Overlays drawn on a MapView with ItemizedOverlay, and an onTap that works when I first start my app. However, if I press the Back button on the Android then start my app again the onTap does not work at all. Other touch sensative operations work fine, like long press on the map and several face buttons. It is also fine if I press the Home button on the phone then go back into my app, so its only on the Back button. It will also work if I first open another app like the Maps app, then go back into my app, acting like a reset.

Overriding the onBackPressed method to move the task to the background also does not work, does anyone have any ideas what would cause this? It happens in both the emulator and on a real device.

I don't know if it will help but here is the relevent code:

CODE:...........................

View 1 Replies View Related

Android :: How To Scale Markers And Set Shadow And OnTap Correctly

Nov 17, 2009

I'm scaling markers on a MapView with the following code

CODE:.........

And:

CODE:.............

Which works, but the shadow below the marker has wrong offset when scaled. Also; i override the public boolean onTap(int index) in ItemizedOverlay to detect taps on the markers, but it seems inaccurate. I can click some range outside the marker and still trigger onTap...

View 1 Replies View Related

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())
{
Log.d("cursor",""+(i++));
point = new GeoPoint(
(int)(mFlavorsCursor.getFloat(mFlavorsCursor.getColumnIndex(DataBaseHelper.KEY_LATITUDE))*1000000),
(int)(mFlavorsCursor.getFloat(mFlavorsCursor.getColumnIndex(DataBaseHelper.KEY_LONGITUDE))*1000000));
overlayitem = new OverlayItem(point, "", "");
itemizedoverlay.addOverlay(overlayitem);
itemizedoverlay.doPopulate();
mFlavorsCursor.moveToNext();
}
mapOverlays.add(itemizedoverlay);

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 :: How To Return Location Pressed To MapActivity From An Overlay OnTap Method

Aug 30, 2010

I have an activity that has a button which opens a new MapActivity to select a location by tapping on the map.

The map has an overlay that overrides the onTap method to get the location but I want to return that location to the previous activity but, I don't know how to return the geopoint to the mapactivity in order to call the setResult() and finish() methods, because I can't call them from the Overlay.onTap method.

View 2 Replies View Related

Android :: Android Maps Overlay OnTap Click

May 5, 2010

Could anyone help me with my below program. I'm unable to put a transparent label containing the contents from my HelloGoogleMaps.java class (Hola, Mundo!) when i click the markers(the android icon) in the map. I would like to have the ontap event do it for different markers here so that that particular location details is popped up. It needs to be in a canvas display. Upon clicking this new canvas label, it should take me to a seperate activity displaying complete details. I'm using the sample program given in the Google Android Website http://developer.android.com/resources/tutorials/views/hello-mapview and i want to extended it to the next level. 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.app.Activity; import android.graphics.drawable.Drawable; import android.os.Bundle;

View 2 Replies View Related

Android :: Android Map Overlay OnTouchEvent / OnTap How To?

Apr 9, 2010

I've implemented a Class that extends Overlay and also override the onTap / onTouchEvent (tried both). Right now it seems like that event is triggered when you tap on the map regardless of position.How can I make sure that the event is triggered only when you tap over the overlay you have added?

View 2 Replies View Related

Android :: HTTP Get Methods?

May 14, 2010

I have written a number of applications for blackberry and am just starting in Android. It seems to me that android has a lot more built in functions. I am starting by recreating some of my BB apps on Android and on one I take a few xml sites and parse them out. On blackberry I implemented this by creating a class that extended a thread. I would construct a new instance of this class with the parameters of my http request and it would call a function back in my main class, sending it the results. I am tempted to reuse my code, but am curious if android has something better built in. I have been looking at the handler class as well as possible using a service.

Bascially, I would like to start a new thread that will return a document of a specific url.

View 1 Replies View Related

Android :: Methods Of Intents Activity?

Jan 8, 2010

I have two applications A and B (in different packages,but it doesn't matter).Application B is an sms application that i have made and contains one activity.This activity has a method called sendSMS(String number,String text).I want to call this method from application A and send an SMS without opening the activity(the GUI) of application B but just send an SMS in the background by calling just the method of the activity.Any ideas?

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved