編集ボタンをクリックすると、すべての itemnames、desc、price がカスタム リストビューで edittext に入ります。edittext に何も入力できません。edittext をクリックすると、アプリケーションが応答しないというエラーが表示されます。
//my code getview method in Base adapter
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.editappetisesrlistview, null);
holder.caption = (EditText) convertView
.findViewById(R.id.editappetisertext);
holder.price=(EditText)convertView.findViewById(R.id.editappetiserprice);
holder.desc=(EditText)convertView.findViewById(R.id.editappetiserdesc);
holder.caption1=(ImageView) convertView.findViewById(R.id.editappetiserimage);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
//Fill EditText with the value you have in data source
holder.caption.setText(itemnames[position]);
holder.price.setText(prices[position]);
holder.desc.setText(descs[position]);
holder.caption.setId(position);
holder.price.setId(position);
holder.desc.setId(position);
holder.caption.setFocusableInTouchMode(true);
holder.price.setFocusableInTouchMode(true);
holder.desc.setFocusableInTouchMode(true);
holder.caption1.setImageBitmap(bmps[position]);
//we need to update adapter once we finish with editing
holder.caption.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus)
{
final int position = v.getId();
final EditText Caption = (EditText) v;
Caption.setFocusable(true);
holder.caption.setFocusable(true);
arr.remove(holder.caption.getId());
arr.add(holder.caption.getId(),holder.caption.getText().toString());
}
}
});
holder.price.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus)
{
final int position = v.getId();
final EditText Caption1 = (EditText) v;
// Caption1.setFocusable(true);
holder.price.setFocusable(true);
arr.remove(holder.price.getId());
arr.add(holder.price.getId(),holder.price.getText().toString());
}
holder.desc.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus)
{
final int position = v.getId();
final EditText Caption2 = (EditText) v;
// Caption2.setFocusable(true);
holder.desc.setFocusable(true);
arr.remove(holder.desc.getId());
arr.add(holder.desc.getId(),holder.desc.getText().toString());
}
}
});
}
});
return convertView;
}
}
ビューホルダー.java
class ViewHolder {
EditText caption,price,desc;
ImageView caption1;
}
class ListItem {
String caption;
}
助けてください