• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why is my listview not returning me to my DetailActivity.class when I'm clicking an item on listview

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having trouble with my ListView. It always sends me back to my login page whenever I press an item on the list. It supposed to go to the details page.

HomeActivity

I learned this code on a youtube channel and I know i followed the instructions well and I'm always checking the intent and still the problem is there. Thank you Guys in advance.

This is my DetailActivity.class. Does this have my problem?

DetailActivity




Android Manifest



Product Class



The error is that the Product cannot be cast to java.io.Serializable
 
Bartender
Posts: 322
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Batz,

Welcome to the Ranch!

In order to cast to Serializable, your Product class must implement the Serializable interface:

As objects within the Intent wrapper could be passed across Threads during the startActivity call, the objects needs to be in a data transferable state. That's where Serialization comes into play. For more information, consider reviewing: https://coderanch.com/t/660236/Wiki/Data-Transfer-Object

I'll add that using the Serializable interface in Android isn't a great idea. Serializable has a lot of baggage that in the resource limited Android world can slow down your app. Android has it's own, much more lightweight, version of Serializable called Parcelable. It's a bit tricky to implement, however, with lots of boilerplate code (google "parcelable generator" for sites that can help with that).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic