Advertisement
zeev

BaseAdapter

Dec 5th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. package com.example.zeevm.mygroupchat;
  2.  
  3. import android.content.Context;
  4. import android.view.View;
  5. import android.view.ViewGroup;
  6. import android.widget.BaseAdapter;
  7. import android.widget.TextView;
  8.  
  9. import java.util.List;
  10.  
  11. /**
  12.  * Created by zeevm on 05/12/2016.
  13.  */
  14.  
  15. public class MsgAdapter extends BaseAdapter {
  16.     Context context;
  17.     List<String> myMsgList;
  18.  
  19.     public MsgAdapter(Context context,List<String> myMsgList)
  20.     {
  21.         this.context=context;
  22.         this.myMsgList=myMsgList;
  23.     }
  24.  
  25.  
  26.     @Override
  27.     public int getCount() {
  28.         return myMsgList.size();
  29.     }
  30.  
  31.     @Override
  32.     public Object getItem(int i) {
  33.         return null;
  34.     }
  35.  
  36.     @Override
  37.     public long getItemId(int i) {
  38.         return 0;
  39.     }
  40.  
  41.     @Override
  42.     public View getView(int i, View view, ViewGroup viewGroup) {
  43.         TextView myMsg = new TextView(context);
  44.         myMsg.setText(myMsgList.get(i));
  45.         return myMsg;
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement