标签: custom-adapter

ListView ArrayAdapter过滤 - 重复项目

我尝试使用自定义适配器过滤listview.当我开始在edittext上输入时,应该过滤列表视图.下面是适配器的代码.自定义对象具有重写的方法toString,它返回facebook用户的名称.我没有覆盖ArrayAdapter方法getItem,添加或删除.

public class FacebookFriendsAdapter extends ArrayAdapter<FacebookUser> {
    private Activity activity;
    public ImageLoader imageLoader;
    private HashMap<String, Integer> alphaIndexer;
    private String[] sections = new String[0];
    private boolean enableSections;

    public FacebookFriendsAdapter(Context context, int textViewResourceId,ArrayList<FacebookUser> newItems) {
        super(context, textViewResourceId, newItems);
        imageLoader = new ImageLoader(context.getApplicationContext());
    }

    public static class ViewHolder {
        public TextView text;
        public ImageView image;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View rowView = convertView;
        FacebookUser fcbu = getItem(position);

        if (convertView == null) {
            LayoutInflater vi = (LayoutInflater) …
Run Code Online (Sandbox Code Playgroud)

android filter custom-adapter

0
推荐指数
1
解决办法
4897
查看次数

如何从Android中的Custom Listview获取单选按钮的值?

这是一个自定义列表视图,通过扩展BaseAdapter.我需要获取所选单选按钮的值,但我不知道如何.所以请帮助我.下面是Custom Adapter类.

public class CustomArrayAdapter extends BaseAdapter implements OnCheckedChangeListener {
private Context context;
private String[] q,o1,o2,o3,o4;
private int count=0;
private ArrayList<HashMap<String, String>> data ;

public CustomArrayAdapter(Context context, ArrayList<HashMap<String, String>> d) {
    super();
    this.context = context;
    data = d;
    count++;
    System.out.println("adhe padhe nuna chate");
}



public View getView(int position, View convertView, ViewGroup parent){
    LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.custom_questions, parent, false);

     TextView tv = (TextView)rowView.findViewById(R.id.textView1);


    RadioGroup rg = (RadioGroup)rowView.findViewById(R.id.radioGroup1);
    final RadioButton rb1 = (RadioButton)rowView.findViewById(R.id.radio0);
    final RadioButton rb2 = (RadioButton)rowView.findViewById(R.id.radio1); …
Run Code Online (Sandbox Code Playgroud)

android android-listview custom-adapter android-radiogroup android-radiobutton

0
推荐指数
1
解决办法
3037
查看次数

无法将列表设置为片段中的自定义适配器

我正在尝试使用自定义适配器创建listview,活动类中的一切都很好.但片段扩展类我不能在我的自定义适配器中设置列表.打印屏幕

android listview fragment custom-adapter

0
推荐指数
1
解决办法
861
查看次数

如何在按钮单击时在Adapter类中获取Tapped List Item位置

我试图在按钮单击时在Adapter类中获取列表项位置,但没有取得任何成功

首先,我必须获取tapped list项,然后想要删除该行

得到这样的东西: D/strPosition::-(1922): com.and.field.Transport@b3ddf5c0

使用以下代码:

viewHolder.btnDelete.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(final View v) {         

                strPosition = arrayList.get(position).toString();
                Log.d("strPosition::-", strPosition);

                // and then want to delete that row using tapped position

                strName = arrayList.get(position).getName().toString();                         

            }
        });
Run Code Online (Sandbox Code Playgroud)

android android-arrayadapter android-listview custom-adapter

0
推荐指数
1
解决办法
3370
查看次数