Diolor / Swipecards

A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.
Apache License 2.0
2.34k stars 583 forks source link

Creating a custom adapter replacing orignal adapter #127

Closed admlawkf closed 8 years ago

admlawkf commented 9 years ago

I have review all the issues. I am trying to replace the blue card with different image background. I know I need to create a custom adapter. I have followed this. http://theopentutorials.com/tutorials/android/listview/android-custom-listview-with-image-and-text-using-arrayadapter/

I added follow in main activity.

    rowItems = new ArrayList();
    listView = (ListView) findViewById(R.id.frame);   // this maybe the problem
    CustomAdapter adapter = new CustomAdapter(this, R.layout.item, null);
    listView.setAdapter(adapter);
    //listView.setOnItemClickListener(this);

    final SwipeFlingAdapterView flingContainer = (SwipeFlingAdapterView) findViewById(R.id.frame);

Here is the error message:

Caused by: java.lang.ClassCastException: com.lorentzos.flingswipe.SwipeFlingAdapterView cannot be cast to android.widget.ListView

After reviewing the error message, I know maybe I shouldn't use listview. Anyone would please tell me how to modify it

Diolor commented 8 years ago

SwipeFlingAdapterView does not extend ListView. Therefore you cannot cast it. Not sure what you were trying to achieve