Mpandroidchart Entry Cannot Be Cast To Barentry
Solution 1:
Using MPAndroidChart 3.0.1
I'm sorry to say this looks like an incomplete implementation of BarEntry
. If you inspect the source, you can see the following:
BarEntry
extendsEntry
Entry
implementsParcelable
BarEntry
doesn't have its ownParcelable<Creator>
So when you serialise into a parcel, and then deserialise, you'll get a List<Entry>
instead of List<BarEntry>
:-)
For now there is nothing you can do apart from work around this.
You can take the opportunity to refactor to achieve a better separation of layers. BarEntry
is a member of the view layer or the view model layer. Instead of passing around BarEntry
, you should probably have a clear model layer which is a mere data object. You can pass lists or arrays of this model layer around in an Intent easily and the consumers can convert to BarEntry
as necessary.
Alternatively, create an abstraction of a data source. Something like a TemperatureRepository
class. Then Activitys and Fragments that consume this data can get the data from the repository rather than from an Intent.
Post a Comment for "Mpandroidchart Entry Cannot Be Cast To Barentry"