Hi all,
I've got an problems on reloading ListView content.
on each time for pressing any button, it will call related .java program for handling content. and each .java program, I've used the following code to inflate xml.
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.market_bluechip_handler, this); list = (ListView) findViewById(R.id.indexListView);
private static class marketBlueChipAdapter extends BaseAdapter { private LayoutInflater mInflater; public marketBlueChipAdapter(Context context) { mInflater = LayoutInflater.from(context); } ....... public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.market_???_item, null);
holder = new ViewHolder();
holder.code = (TextView) convertView.findViewById(R.id.no);
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.totalValue = (TextView) convertView.findViewById(R.id.total_value);
holder.changeValue = (TextView) convertView.findViewById(R.id.change);
holder.code.setFocusable(false);
holder.name.setFocusable(false);
holder.totalValue.setFocusable(false);
holder.changeValue.setFocusable(false);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.code.setText(value[position][4]);
holder.name.setText(value[position][0]);
boolean up_string = value[position][5].startsWith("+", 0);
boolean down_string = value[position][5].startsWith("-", 0);
if(up_string == true){
holder.totalValue.setTextColor(Color.GREEN);
holder.changeValue.setTextColor(Color.GREEN);
holder.totalValue.setText("↑ "+value[position][2]);
holder.changeValue.setText(value[position][5]);
}else if(down_string==true){
holder.totalValue.setTextColor(Color.RED);
holder.changeValue.setTextColor(Color.RED);
holder.totalValue.setText("↓ "+value[position][2]);
holder.changeValue.setText(value[position][5]);
}else{
holder.totalValue.setTextColor(Color.WHITE);
holder.changeValue.setTextColor(Color.WHITE);
holder.totalValue.setText(value[position][2]);
holder.changeValue.setText(value[position][5]);
}
return convertView;
}
that takes a super long time to display on screen, does any one have the same problems before?
Thanks for helping. ^_^