i have a custom listView with custom adapter, there are name, designation and some other information.i want to use search(widget) option in that please help me.
here is my adapter code:
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.media.Image;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
/**
* Created by Imran on 10/25/2015.
*/
public class ContactAdapter extends ArrayAdapter<ContactModel> {
private ArrayList<ContactModel> contactList;
private ContactModel contactModel;
Context context;
TextView name;
TextView company;
TextView designation;
TextView phoneNo;
TextView email;
ImageView image;
public ContactAdapter(Context context, ArrayList<ContactModel> contactList) {
super(context, R.layout.customlayout,contactList);
this.context=context;
this.contactList=contactList;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView=layoutInflater.inflate(R.layout.customlayout,parent,false);
image= (ImageView) convertView.findViewById(R.id.imageId);
name=(TextView)convertView.findViewById(R.id.textViewNameId);
company=(TextView)convertView.findViewById(R.id.textViewCompanyId);
designation=(TextView)convertView.findViewById(R.id.textViewDesignationId);
phoneNo=(TextView)convertView.findViewById(R.id.textViewPhoneNoId);
email=(TextView)convertView.findViewById(R.id.textViewEmailId);
contactModel=contactList.get(position);
name.setText(contactModel.getName());
company.setText(contactModel.getCompanyName());
designation.setText(contactModel.getDesignation());
phoneNo.setText(contactModel.getPhoneNo());
email.setText(contactModel.getEmail());
return convertView;
}
}
please help me. will be more grateful if you please show me the way to add search widget. i have searched online much but there is no solution like what i want. so please help me. waiting for your kind help. thank you
Aucun commentaire:
Enregistrer un commentaire