title: How to customize Adapter for SwipeCard?
body: <p>I am making a flash card app with <a href="https://github.com/chanjungkim/Swipecards" rel="nofollow noreferrer">SwipeCard</a> </p>
  
  <p>This is my <code>FlashCardActivity</code>:</p>
  
  <pre><code>import android.os.Bundle;
  import android.text.style.TtsSpan;
  import android.util.Log;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.Toast;
  
  import com.google.gson.Gson;
  import com.lorentzos.flingswipe.SwipeFlingAdapterView;
  
  import org.koreanlab.fabloading.R;
  import org.koreanlab.fabloading.adapter.CardListAdapter;
  import org.koreanlab.fabloading.basickit.BasicCompatActivity;
  import org.koreanlab.fabloading.basickit.remote.RemoteService;
  import org.koreanlab.fabloading.basickit.remote.ServiceGenerator;
  import org.koreanlab.fabloading.item.CardItem;
  
  import java.util.ArrayList;
  
  import butterknife.BindView;
  import butterknife.ButterKnife;
  import butterknife.OnClick;
  import retrofit2.Call;
  import retrofit2.Callback;
  import retrofit2.Response;
  
  public class FlashCardActivity extends BasicCompatActivity {
      private String TAG = getClass().getSimpleName();
      private ArrayList&lt;CardItem&gt; cardList;
      private ArrayAdapter&lt;String&gt; cardAdapter;
      private CardListAdapter cardListAdapter;
  
      private int i;
      CardItem newCard;
  
      @BindView(R.id.frame)
      SwipeFlingAdapterView flingContainer;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_flashcard);
          ButterKnife.bind(this);
  
          cardList = new ArrayList&lt;&gt;();
          Log.d(TAG, "cardList created");
  
          // get Two Words;
          cardList.add(getCardItem());
          cardList.add(getCardItem());
  
          Log.d(TAG, "added Card");
          cardListAdapter = new CardListAdapter(this, R.layout.card_item, cardList);
          Log.d(TAG, "adapter created: " + (cardListAdapter == null ? "cardAdapter is NULL" : "cardAdapter is not NULL"));
          flingContainer.setAdapter(cardListAdapter);
          Log.d(TAG, "adapter set: " + (flingContainer == null ? "flingContainer is NULL" : "flingContainer is not NULL"));
          flingContainer.setFlingListener(new SwipeFlingAdapterView.onFlingListener() {
              @Override
              public void removeFirstObjectInAdapter() {
                  // this is the simplest way to delete an object from the Adapter (/AdapterView)
                  Log.d("LIST", "removed object!");
                  cardList.remove(0);
                  cardListAdapter.notifyDataSetChanged();
              }
  
              @Override
              public void onLeftCardExit(Object dataObject) {
                  //Do something on the left!
                  //You also have access to the original object.
                  //If you want to use it just cast it (String) dataObject
                  makeToast(FlashCardActivity.this, "Left!");
              }
  
              @Override
              public void onRightCardExit(Object dataObject) {
                  makeToast(FlashCardActivity.this, "Right!");
              }
  
              @Override
              public void onAdapterAboutToEmpty(int itemsInAdapter) {
                  // Ask for more data here
                  Log.d(TAG, "onAdapterAboutToEmpty: "+itemsInAdapter);
                  cardList.add(getCardItem());
                  cardListAdapter.notifyDataSetChanged();
                  Log.d("LIST", "notified");
                  i++;
              }
  
              @Override
              public void onScroll(float scrollProgressPercent) {
                  View view = flingContainer.getSelectedView();
                  view.findViewById(R.id.item_swipe_right_indicator).setAlpha(scrollProgressPercent &lt; 0 ? -scrollProgressPercent : 0);
                  view.findViewById(R.id.item_swipe_left_indicator).setAlpha(scrollProgressPercent &gt; 0 ? scrollProgressPercent : 0);
              }
          });
  
          // Optionally add an OnItemClickListener
          flingContainer.setOnItemClickListener(new SwipeFlingAdapterView.OnItemClickListener() {
              @Override
              public void onItemClicked(int itemPosition, Object dataObject) {
                  makeToast(FlashCardActivity.this, "Clicked!");
              }
          });
      }
  
      @OnClick(R.id.right)
      public void right() {
          /**
           * Trigger the right event manually.
           */
          flingContainer.getTopCardListener().selectRight();
      }
  
      @OnClick(R.id.left)
      public void left() {
          flingContainer.getTopCardListener().selectLeft();
      }
  
      public CardItem getCardItem() {
          // No problem here.
          return newCard;
      }    
  }
  </code></pre>
  
  <p>Notice that, <code>getCardItem()</code> just get one card. First of all, it calls two cards and the cardList has two cards when activity has created. And after that I'd like to get just one card after swipe. <code>getCardItem()</code> has no problem. I can see that I receives the data from my Server.</p>
  
  <p>This is my custom <code>CardListAdapter</code>:</p>
  
  <pre><code>import android.content.Context;
  import android.support.v7.widget.RecyclerView;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.TextView;
  
  import org.koreanlab.fabloading.R;
  import org.koreanlab.fabloading.item.CardItem;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class CardListAdapter extends ArrayAdapter {
      private final String TAG = this.getClass().getSimpleName();
      private Context context;
      private int cardResId;
      private int frontResId;
      private int backResId;
      private List&lt;CardItem&gt; cardList;
      private LayoutInflater mInflater;
  
      //this, R.layout.card_item, R.id.card_front, R.id.card_back, cardList
      public CardListAdapter(Context context, int cardResId, ArrayList&lt;CardItem&gt; cardList) {
          super(context, cardResId);
          this.context = context;
          this.cardResId = cardResId;
          this.cardList = cardList;
  
          mInflater = LayoutInflater.from(context);
      }
  
      public void setItem(CardItem newItem) {
          Log.d(TAG, "setItem");
  
          for (int i = 0; i &lt; cardList.size(); i++) {
              CardItem item = cardList.get(i);
  
              if (item.seq == newItem.seq) {
                  cardList.set(i, newItem);
                  break;
              }
          }
      }
  
      @Override
      public int getCount() {
          Log.d(TAG, "getVIew");
          return 0;
      }
  
      public int getPosition(CardItem item) {
          Log.d(TAG, "getPosition = "+item);
          return cardList.indexOf(item);
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          ViewHolder holder;
          if(convertView == null){
              convertView = mInflater.inflate(cardResId, parent,false);
              holder = new ViewHolder();
              Log.d(TAG, "getView");
  
              holder.frontTV = convertView.findViewById(R.id.card_front);
              holder.backTV = convertView.findViewById(R.id.card_back);
              convertView.setTag(holder);
          }else{
              holder = (ViewHolder)convertView.getTag();
          }
          holder.frontTV.setText((String)getItem(position));
          holder.backTV.setText((String)getItem(position));
          return convertView;
      }
      static class ViewHolder
      {
          TextView frontTV, backTV;
      }
  }
  </code></pre>
  
  <p>I checked many blogs and other Q&amp;A, but I haven't figured it out how to solve this problem. That activity keeps going back after receiving 'one word' data from the Server and It doesn't show any error messages.</p>