Galera, alguém sabe como fazer um Search em uma ListView ?
/**
* Definition of the list adapter
*/
public class FriendListAdapter extends BaseAdapter {
private LayoutInflater mInflater;
EscolhaAmigosFacebook friendsList;
public FriendListAdapter(EscolhaAmigosFacebook friendsList) {
this.friendsList = friendsList;
if (Utility.model == null) {
Utility.model = new FriendsGetProfilePics();
}
Utility.model.setListener(this);
mInflater = LayoutInflater.from(friendsList.getBaseContext());
}
@Override
public int getCount() {
return jsonArray.length();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
JSONObject jsonObject = null;
final ViewHolder holder;
final int pos=position;
try {
jsonObject = jsonArray.getJSONObject(position);
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (convertView == null) {
convertView = mInflater.inflate(R.layout.friend_item, null);
holder = new ViewHolder();
holder.profile_pic = (ImageView) convertView.findViewById(R.id.profile_pic);
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.search = (EditText) convertView.findViewById(R.id.et_Search);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
try {
holder.profile_pic.setImageBitmap(Utility.model.getImage(
jsonObject.getString("id"), jsonObject.getString("picture")));
} catch (JSONException e) {
holder.name.setText("");
}
try {
holder.name.setText(jsonObject.getString("name"));
} catch (JSONException e) {
holder.name.setText("");
}
return convertView;
}
}






0 comentários:
Postar um comentário