Olá Pessoal,
Consegui resolver o problema usando a Classe ViewHolder, vou colocar aqui o codigo da minha Adapter já com a implementação do ViewHolder:
package com.brasalrefrigerantes.egomes.qmobile11.Adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.TextView;
import com.brasalrefrigerantes.egomes.qmobile11.Banco.Model.Caracteristicas;
import com.brasalrefrigerantes.egomes.qmobile11.R;
import java.util.List;
/*
Created by EGomes on 30/01/2016.
*/
public class CaracteristicasAdapter extends BaseAdapter {
private Context context;
private List lista;
public CaracteristicasAdapter(Context c, List l) {
this.context = c;
this.lista = l;
}
@Override
public int getCount() {
return lista.size();
}
@Override
public void notifyDataSetChanged() {
super.notifyDataSetChanged();
}
@Override
public Object getItem(int position) {
return lista.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
Caracteristicas caracteristicas = lista.get(position);
if (convertView == null){
holder = new ViewHolder();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.analises,null);
holder.edAnalise = (EditText) convertView.findViewById(R.id.edAnalise);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
TextView txtAnalise = (TextView) convertView.findViewById(R.id.txtAnalise);
//preenchendo com valores da lista
holder.edAnalise.setText(lista.get(position).getFac());
holder.edAnalise.setId(position);
//depois de editar precisamos atualizar o adapter
holder.edAnalise.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus){
final int position = v.getId();
// final EditText edAnalise = (EditText) convertView.findViewById(R.id.edAnalise);
final EditText edAnalise = (EditText) v;
lista.get(position).setFac( edAnalise.getText().toString());
}
}
});
//necessário para recuperar os valores em ListaordensPorLinha
txtAnalise.setText(caracteristicas.getDesc_caracteristica());
return convertView;
}
class ViewHolder{
EditText edAnalise;
}
class ListItem{
String edAnalise;
}
}