add text to a drawable? (maps question)

by Michael Dorin » Wed, 10 Mar 2010 23:26:31 GMT


Sponsored Links
 I am doing a map application and would like to put more than just a
'star' or a 'pin' on the map when it is selected.
Is it possible to make a drawable icon, and shove some text into it?
That way I could have a bit of info and the location tagged.

Thanks,
  Mike

--



add text to a drawable? (maps question)

by Mark Murphy » Wed, 10 Mar 2010 23:29:29 GMT


 


You can certainly have different Drawables per pin at runtime:

 http://github.com/commonsguy/cw-advandroid/tree/master/Maps/ILuvNooYawk/ 

I haven't tried creating a custom Drawable, rendered from a Canvas or
something, so I don't know much about that aspect.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Training...At Your Office:  http://commonsware.com/training 

--


Sponsored Links


Other Threads

1. Can alternative menu items display icons in m5?

I want to include an alternative menu item, similar as is done in the
NotesList sample, but I want to add an icon. What would be the
appropriate place to specify the icon?

I'm adding the alternative menu through the following code:

Intent intent = new Intent(null, mListUri);
        intent.addCategory(Intent.ALTERNATIVE_CATEGORY);
        menu.addIntentOptions(
                Menu.ALTERNATIVE, 0,
                new ComponentName(this, ShoppingView.class),
                null, intent, 0, null);

which displays correctly the menu item that is specified here:

<activity android:name=".shopping.ListShareSettingsActivity"
        android:label="@string/share_settings"          
android:theme="@android:style/
Theme.Dialog"           android:icon="@drawable/contact_share001a">
             <intent-filter android:label="@string/share"
                android:icon="@drawable/contact_share001a">
                <action
android:name="org.openintents.action.SET_SHARE_SETTINGS" />
                <category
android:name="android.intent.category.DEFAULT" />
                <category
android:name="android.intent.category.ALTERNATIVE" />
                <category
android:name="android.intent.category.SELECTED_ALTERNATIVE" />
                <data android:mimeType="vnd.android.cursor.item/
vnd.openintents.shopping.list" />
            </intent-filter>
        </activity>

It shows the string as specified in @string/share, but I don't get to
see the icon specified in @drawable/contact_share001a.

Since the notepad example does not display menu icons, it is difficult
to tell whether this feature should work in principle in m5 or not.

Peli


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

2. About bullets

Hi



 Can we use bullets in android.if so?what is the syntax pls tell me



Thanks
judy

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

3. Asynchronously loading problem

4. Revenue generated by developers

5. Assess other variable from other class in the same package !

6. how to show alerts

7. Selecting from a listview...how do I know what I clicked on?