Invalid Payload type Android
android, android-actionbar-compat
Solution
Apparently this is a bug in Android itself. It is fixed with the following commit:
commit 332944f8a0a001c1754ce3298edbb4246e53c8fb
Author: zobject <zbjection@gmail.com>
Date: Mon Dec 10 22:52:59 2012 +0900
Fix EventLog string class problem in onOptionMenuSelected
EventLog function can handle string,integer class and long class. (in android_util_EventLog.cpp)
If menu title string are used bold tag(like <b>test</b>), it'll be android.text.SpannedString.
In onOptionMenuSelected, it is using item.getTitleCondensed() function for writing event log.
therefore any android activity using tag menu string(like <b></b>) can be crashed by IllegalArgumentException.
I found this crash on GMS Application.
change locale chinese -> launch Google+ -> hangout -> menu key -> Invite(expressed chinese) click -> Google+ crash
Change-Id: I0437be81699925e29bf4510eb615ef2424432763
Problem
After a new update, I've discovered an issue with the compatibility of spannable/formatted strings in action bars and LG devices. Here's my code before: ``` SpannableString s = new SpannableString("About"); s.setSpan(new TypefaceSpan(this, "Sansation-Regular.ttf"), 0, s.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); getSupportActionBar().setTitle(s); ``` I believe on setTitle is when it crashes and gives this error: ``` java.lang.IllegalArgumentException: Invalid payload item type at android.util.EventLog.writeEvent(Native Method) ``` Would this fix any potential issues? I'm new to Android so wouldn't know. Because the issue seems to only happen with LG devices running 4.1.2 using actionbarcompat - but because I plan to add in support for lower API levels in the future, I don't really want to get rid of actionbarcompat for now. ``` SpannableString s = new SpannableString("About"); s.setSpan(new TypefaceSpan(this, "Sansation-Regular.ttf"), 0, s.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); try{ getSupportActionBar().setTitle(s); }catch(IllegalArgumentException e) { getSupportActionBar().setTitle("About"); } ``` Thanks.! PS: Device in question is LG's running 4.1.2