In my application I am using a CustomListView
with an ArrayAdapter
to show different countries time. But after 6 to 7 rows(depending on the phone screen size) the time values are repeating.
According to some previous post I have written the following code snippet to get the solution. But the problem is still there.
Following is the code I have written:
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
Order o = items.get(position);
if (v == null) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout ll = (LinearLayout) vi.inflate(R.layout.row, null);
CustomDigitalClock customDC = new CustomDigitalClock(CityList.this, o.getOrderTime());
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.FILL_PARENT);
customDC.setTextColor(Color.WHITE);
customDC.setTextSize(13);
LayoutParams param=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
ll.addView(customDC, 2);
v = ll;
}
if (o != null) {
TextView tt = (TextView) v.findViewById(R.id.toptext);
TextView bt = (TextView) v.findViewById(R.id.bottomtext);
if (tt != null) {
tt.setText("" + o.getOrderName());
}
if (bt != null) {
bt.setText("" + o.getOrderStatus());
}
v.setOnCreateContextMenuListener(this);
}
return v;
}
Can anybody help me?