I've a problem to populate a listview from a cursor filled from db. I
can't understand why, newView and bindView are not called.
The stupid things is that I've already done this thing other times but
now doesn't work, and I can't undestand where is the problem.
this is my code:
_curAround is filled with a few records.
ListaAdapter rA = new ListaAdapter(this, _curAround, point);
ListView list = (ListView) findViewById(R.id.lvLista);
list.setAdapter(rA);
public class ListaAdapter extends CursorAdapter {
private LayoutInflater mInflater;
GeoPoint _MyPos;
public ListaAdapter(Context context, Cursor c, GeoPoint mypos) {
super(context, c);
mInflater = LayoutInflater.from(context);
_MyPos = mypos;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
Aggiorna(view, cursor);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent)
{
View v= mInflater.inflate(R.layout.item, null);
Aggiorna(v, cursor);
return v;
}
void Aggiorna(View v, Cursor cur){
FarmaCity.MyLog("Lista", "Nome:"+cur.getString(1));
TextView t = (TextView) v.findViewById(R.id.tvNome);
t.setText(cur.getString(1));/*
t = (TextView) v.findViewById(R.id.tvIndirizzo);
t.setText(cur.getString(2));
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en