baoyongzhang / baoyongzhang/SwipeMenuListView

cannot be cast to android.widget.BaseAdapter

Open
#166 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

i have cursor that retrieve data from database and display it in ListView
get this Error when i try to Display in SwipeMenuListView
this is the error
java.lang.ClassCastException: com.baoyz.swipemenulistview.SwipeMenuListView$1 cannot be cast to android.widget.BaseAdapter

this is my code

` public void populateListView() {
Cursor cursor = myDB.searchname(null);
String[] fromFieldNames = new String[]{DataBaseAdapter.KEY_ROWID, DataBaseAdapter.KEY_NAME, DataBaseAdapter.KEY_DATE};
int[] toviewIDs = new int[]{R.id.textViewpnumber, R.id.textViewpname, R.id.textViewdate};
mycursoradapter = new SimpleCursorAdapter(this, R.layout.item_layout, cursor, fromFieldNames, toviewIDs, 0);
mylist = findViewById(R.id.Listtest);
mylist.setAdapter(mycursoradapter);
mylist.setFastScrollEnabled(true);
mylist.setTextFilterEnabled(true);
}`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the populateListView entry point and inspect how SimpleCursorAdapter is passed to SwipeMenuListView.setAdapter. Reproduce the ClassCastException with the supplied cursor and adapter setup; done means the list displays the database rows without the cast error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.