I am using BaseAdapter
for displaying some items.
I don't want to change the text for item at position zero.
So getView
method of my BaseAdapter
looks like
public View getView(int position, View view, ViewGroup parent) {
try {
if(view == null) {
view = LayoutInflater.from(context).inflate(R.layout.item_bill, parent, false);
}
Log.e("BillAdapter", "Position :: " + position);
if(position == 0) {
Log.e("BillAdapter", "Position zero. Not changing values....");
} else {
Bill bill = items.get(position);
Log.e("BillAdapter", position + " :: " + bill.toString());
TextView textDate = (TextView) view.findViewById(R.id.text_date);
textDate.setText(bill.getDate());
TextView textPaidAmount = (TextView) view.findViewById(R.id.text_paid_amount);
textPaidAmount.setText(String.format("%2.2f", bill.getPaidAmount()));
}
} catch (Exception ex) {
Log.e("BillAdpater", Log.getStackTraceString(ex));
}
return view;
}
But my output is
I'm using the same logic in my all applications and it works. I don't know whats wrong in this.
It reflects the last value at first position.
I tried to rebuild the project, clean the project, but no success.
Thanks in advance.