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?

Android : Way to use 9-patch / text for ItemizedOverlay on MapView?


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 :: 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 :: Using 9 Patch Background On Button - Cannot Add Padding Around Text

Aug 21, 2010

As the title says, I cannot get padding around the text.Here's my xml:
<style name="StandardButton" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/nine_patch_3</item>
<item name="android:textColor">@color/white</item>
<item name="android:textStyle">bold</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:paddingRight">10dp</item>
</style>

View 1 Replies View Related

Android :: Draw Text With Border On MapView?

Nov 12, 2009

I'm trying to draw some text onto an MapView on Android. The drawing of the text goes fine, but it's very hard to read the text because it's white with no black border (like the rest of the text that appears naturally on MapViews to denote cities, states, and countries). I can't seem to figure how to draw the text with a black border. This is the sort of code I'm using right now (this is just example code, found in one of my overlays):

@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(16);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, textPaint);
super.draw(canvas, mapView, shadow);}

View 3 Replies View Related

Android : Save / Activity With MapView And After Reload Same Mapview?

Jul 16, 2010

I had found a lot of stackoverflow post about save an Activity and the reload it.

My question: How can I have an Activity with an MapView and after reload the same mapview?

What is the best way to switch between activity and views?

View 2 Replies View Related

Android :: Display Simple Text Label / Description Bubble When User Taps On OverlayItem In MapView?

Dec 29, 2009

I would like to further annotate the custom markers I have placed on a MapView (using ItemizedOverlay) by displaying a simple text label that appears for a particular item when the onTap event is fired.

This is a trivial exercise in the Google Maps JavaScript API and in MapKit on iPhone, but it is not obvious to me what the best or easiest way to do this is on Android.

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 :: 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 :: 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 :: 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 :: 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 :: 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 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 : How To Cover A 9-PATCH-PNG Entirely?

Sep 21, 2010

I try to implement a hover effect (effect when button is pressed) through putting a semi transparent PNG file on top of the button background and the button icon. Unfortunatly the button background file is a 9-PATCH-PNG which causes some trouble here: It "swallows" everything on top of its layer and doesn't allow to cover the stretchable areas (the fine light line around) of the nine-patch-png. In other words, the black lines the top and left edge of the 9 PATCH PNG cause not only stretching, but also padding behavior.

View 4 Replies View Related

Android :: Way To Get A Nine Patch Loader For IPhone?

Jul 16, 2009

Android has a nice way of defining stretchable images called a nine-patch. See these docs for a description of the concept. The idea is to surround a png image with a 1-pixel border where you can define the stretchable areas and the padding dimensions of the image. This is absolutely brilliant and I'd like to use the idea in my iPhone app. Before writing my own nine-patch to UIImage loader I thought I'd see if one already exists. Google doesn't return any results so I don't have much hope, but it doesn't hurt to ask, right?

View 4 Replies View Related

Android :: How To Create 9-patch Images?

Aug 4, 2010

I want to know how can we create 9-patch images.

View 8 Replies View Related

Android :: Way To Modify 9 Patch Images?

Sep 24, 2009

I wish to customize the button images, but after I opened the png file, changed the color, reimported back into the draw9patch editor, the compiler spew out errors. how can I modify the 9 patch image of the default button?

View 2 Replies View Related

Android :: Drawing A Nine Patch Image

Nov 29, 2009

I'm trying to create on of these images, but Eclipse won't accept it once I've used the draw9patch tool. I've found other people having the same problem, and saw this comment: I discovered later that the problem I was having was caused by the image not being exactly true to the nine-patch spec as defined in the documentation. Once I fixed the image to have a clean (i.e., no gradients etc) one pixel border it was fine. "'m not much good when it comes to image design. What does this mean, how do I create my original png file to meet the specification for Nine Patch?

View 2 Replies View Related

Android :: Nine Patch Pre-scaling On Hdpi

Jan 5, 2010

I have some 9-patch images on my app, and they work great on the medium density. When I load the app on a High density emulator/device, these images look grainy. It happens only to 9-patch images. The others look great after the pre- scaling. Is there a way to make them look good after the scaling, like the non-9-patch images?

View 10 Replies View Related

Android :: Confused About 9-patch Files

Mar 2, 2009

Can someone please explain or provide examples (links) of some valid 9- patch files? From reading the API description, I think my understanding is flawed. As an example, there's a 9-patch located at: http://www.maladroid.net/test.9.png Code...

View 9 Replies View Related

Android : Way To Draw Nine Patch Onto Canvas?

Jan 24, 2010

I'm trying to draw a nine patch onto a Canvas object on the Android. What seems strange is that although I generated my nine patch using the draw9patch tool, the constructor for NinePatch requires an additional byte array called the "chunk" to construct the nine patch. Why isn't this simpler? What is the "chunk"? And if you have done this yourself, how did you go about it?

View 1 Replies View Related

Android : Way To Get More Than 1 Nine Patch Image At A Time?

Sep 10, 2010

I am having problems with nine patch images ( **.9.png ). I have a widget layout and would like to use nine patch images for the widget's backgroud. Here is my background.xml...

View 2 Replies View Related

Android : How To Patch Linux Kernel?

Nov 17, 2010

I am having a serious problem. What i have in my hand : Linux Kernel 2.6.29 with Android Eclair patches and some board specific patches(as .patch files). Linux Kernel 2.6.32 with Android Froyo patches.

View 1 Replies View Related







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