[android-developers] Re: MenuItem with Spanned elements in their titles
Just to close this off, apparently in MenuItems for context menus you
need to use a string for the condensedTitle because the internal
EventLog is dumb.
On Aug 19, 7:28 pm, Greg Giacovelli <miyamo...@gmail.com> wrote:
> Hi I was just trying something and realized this doesn't seem possible
> due to the debugging code in the android OS.
>
> I register a context menu on an AdapterView, via
> registerContextMenu(mAdapterView), and then implement the
> onCreateContextMenu, like this:
>
> CharSequence title = context.getString(R.string.txt, userName);
> title = Html.fromHtml((String) title);
> MenuItem item = menu.add(ContextMenu.NONE, ContextMenu.NONE,
> ContextMenu.NONE, title);
>
> The context menu displays correctly, however when it is clicked I get
> an illegalArgumentException from the EventLog class when it tries to
> print out the condensedTitle.
>
> So I have found without setting the condensedTitle explicitly to
> something that is a String this occurs. Why is this marked as a
> CharSequence if it cannot handle it?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home