java.lang.ClassCastException: java.lang.String cannot be cast to com.example.manish.userdetail.Contact

Stack Overflow | Manish Gupta | 7 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Android Baseadapter to populate ListView

    Stack Overflow | 7 months ago | Manish Gupta
    java.lang.ClassCastException: java.lang.String cannot be cast to com.example.manish.userdetail.Contact

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.String cannot be cast to com.example.manish.userdetail.Contact

      at com.example.manish.userdetail.CustomAdapter.getView()
    2. com.example.manish
      CustomAdapter.getView
      1. com.example.manish.userdetail.CustomAdapter.getView(CustomAdapter.java:67)
      1 frame
    3. Android Platform
      ViewGroup.layout
      1. android.widget.AbsListView.obtainView(AbsListView.java:2255)
      2. android.widget.ListView.makeAndAddView(ListView.java:1790)
      3. android.widget.ListView.fillDown(ListView.java:691)
      4. android.widget.ListView.fillFromTop(ListView.java:752)
      5. android.widget.ListView.layoutChildren(ListView.java:1630)
      6. android.widget.AbsListView.onLayout(AbsListView.java:2087)
      7. android.view.View.layout(View.java:14860)
      8. android.view.ViewGroup.layout(ViewGroup.java:4643)
      9. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
      10. android.view.View.layout(View.java:14860)
      11. android.view.ViewGroup.layout(ViewGroup.java:4643)
      12. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
      13. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
      14. android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
      15. android.view.View.layout(View.java:14860)
      16. android.view.ViewGroup.layout(ViewGroup.java:4643)
      17. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
      18. android.view.View.layout(View.java:14860)
      19. android.view.ViewGroup.layout(ViewGroup.java:4643)
      19 frames
    4. android.support.design
      CoordinatorLayout.onLayout
      1. android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1037)
      2. android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:747)
      3. android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
      4. android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1156)
      5. android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:760)
      5 frames
    5. Android Platform
      ViewGroup.layout
      1. android.view.View.layout(View.java:14860)
      2. android.view.ViewGroup.layout(ViewGroup.java:4643)
      2 frames
    6. Android Support v4
      DrawerLayout.onLayout
      1. android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
      1 frame
    7. Android Platform
      Choreographer$FrameDisplayEventReceiver.run
      1. android.view.View.layout(View.java:14860)
      2. android.view.ViewGroup.layout(ViewGroup.java:4643)
      3. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
      4. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
      5. android.view.View.layout(View.java:14860)
      6. android.view.ViewGroup.layout(ViewGroup.java:4643)
      7. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
      8. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
      9. android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
      10. android.view.View.layout(View.java:14860)
      11. android.view.ViewGroup.layout(ViewGroup.java:4643)
      12. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
      13. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
      14. android.view.View.layout(View.java:14860)
      15. android.view.ViewGroup.layout(ViewGroup.java:4643)
      16. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
      17. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
      18. android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
      19. android.view.View.layout(View.java:14860)
      20. android.view.ViewGroup.layout(ViewGroup.java:4643)
      21. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
      22. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
      23. android.view.View.layout(View.java:14860)
      24. android.view.ViewGroup.layout(ViewGroup.java:4643)
      25. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2013)
      26. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1770)
      27. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1019)
      28. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5725)
      29. android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
      30. android.view.Choreographer.doCallbacks(Choreographer.java:574)
      31. android.view.Choreographer.doFrame(Choreographer.java:544)
      32. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
      32 frames