如何获得两个编辑文本(标题和内容)以及如何将它们保存在ListView中 - android

时间:2012-03-15 01:14:27

标签: android listview

我想在这里是当我点击标题列表视图时,内容将显示在对话框中。

1 个答案:

答案 0 :(得分:0)

 try this, hope this will help you.
 @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                ViewHolder holder;
                View view = convertView;
                if (view == null) {
                    LayoutInflater inflater = context.getLayoutInflater();
                    view = inflater.inflate(R.layout.row, null, true);
                    holder = new ViewHolder();
                    holder.title = (TextView) view.findViewById(R.id.title);

                    view.setTag(holder);
                } else {
                    holder = (ViewHolder) view.getTag();
                }

                holder.title.setText("your title");

                holder.title.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View arg0) {
                                // TODO Auto-generated method stub
                            Toast.makeText(YourActivity.this,
                              "TextView clicked",Toast.LENGTH_SHORT).show();

                //show dialog, pass information to dialog respective
                               //item click 
                }
            });

                return view;
            }