Closed iskugor closed 5 years ago
The problem is in the logic to save and restore the instance state. What class are you setting as the type for the TokenCompleteTextView subclass? I'm guessing that the class type you're setting isn't playing nice with the default save and restore instance state code.
Probably the solution will be for you to implement these yourself as described here: https://github.com/splitwise/TokenAutoComplete#restoring-the-view-state
I have similar problem with latest version (v3.0.1). When onPause fires and onsaveInstance called on TokenCompleteTextView, it throws same error. I am using ContactsCompletionView sample you provided on readme to extend for TokenCompleteTextView. My model is seralizable/parcelable but still I try to implement convertSerializableObjectsToTypedObjects & getSerializableObjects, still it is throwing same error.When I check code flow this crash occures before this functions fires on reifyParameterizedTypeClass line 1337.
Edit: this diagnosis is incorrect, the issue was that the TokenCompleteTextView
type parameter was not set.
Ok, so the core of the problem is that calling getClass
on whatever object is getting hit by this is returning a class that is not a subclass (at any level of remove) of TokenCompleteTextView
. I suspect something is happening to make your system use a reference to a raw TokenCompleteTextView
instead of your subclass somehow. Is there any place in your code that you directly reference your view as a TokenCompleteTextView
instead of your subclass? Maybe in the layout?
I'm not able to reproduce this in the sample app, though this might be an app, keyboard or OS version issue. Can you give me those details?
@mgod I solved why it happens.
My class which extends TokenCompleteTextView was like this:
public class ContactsCompletionView extends TokenCompleteTextView
I wasn't passing my model while extending TokenCompleteTextView, It was working with V2.
Now I reaalized that code piece which throws error needs to know my model class. So while extending I am passing my model as well as your sample:
public class ContactsCompletionView extends TokenCompleteTextView<ModelRelationChips>
And all problems gone away.
Thanks for help.
@nrazon Thanks for the follow-up. I'm going to close this for now, but I know this kind of issue doesn't pop up until you've had to save instance state, so I'll probably look into seeing if I can surface an error message/exception for this sooner or work around this specific case.
This should be duplicated with #449 if you were enabling R8 fullMode.
Hello.
I'm using latest 3.0.1 version.
When device is rotated, app crashes with logs:
Any idea how to fix this?
Thanks.