You're trying to call the method getTime()
from a long
value. The getItemId()
won't return the object you want, it'll return, as the method signature suggests, only the ID (of the type long
).
I don't know Adapter subclass you're using, but most likely you have to implement a method to retrieve the item on the provided position. Something like:
private MyItem getItemAtPosition(int position) {
return mItems.get(position);
}
Edit: Also, you should read the docs on BaseAdapter
and this tutorial on how to subclass BaseAdapter
to fill a custom view.
If you're using an ArrayAdapter
, check Fusselchen answer.
I recommend that you see this related question on how to interpret the stack trace. That can be really helpful while debugging. On your particular case it would've lead to the conversion problem.
P.S.: You should try Udacity's Java and Android courses, or any other material on Java and Android. They will give you more experience when developing apps and will help you to solve those kinds of problems in the future.
Google is a powerful tool, use it to your advantage.