public class LazyAdapter extends BaseAdapter {
private Activity activity;
private ArrayList<MessageData> _items;
private LayoutInflater inflater=null;
public ImageLoader imageLoader;
// int count = 10;
public LazyAdapter(Activity a,ArrayList<MessageData> _items) {
activity = a;
this._items=_items;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount() {
return _items.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
class ViewHolder{
public TextView _nametitle,_timedesc;
public ImageView _imageview;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater= activity.getLayoutInflater();
View agntLocator=inflater.inflate(R.layout.msgdetailsrow, null);
String _imgurl = _items.get(position)._image.toString().replaceAll(" ","%20");
Log.d("ddddd","ddddddddd"+_imgurl);
_img[position] = (ImageView)agntLocator.findViewById(R.id._msgrowimg);
//_img[position].setImageBitmap(bmImg);
imageLoader.DisplayImage(_imgurl, this.activity, _img[position]);
_img[position].measure(60,40);
// _img[position].setOnClickListener(new Clickble());
nametxt[position]=(TextView)agntLocator.findViewById(R.id._msgrowname);
nametxt[position].setText(_items.get(position)._sendername);
messagetxt[position]=(TextView)agntLocator.findViewById(R.id._msgrowmessge);
messagetxt[position].setText(_items.get(position)._messdesc);
timetxt[position]=(TextView)agntLocator.findViewById(R.id._msgrowtimefigure);
timetxt[position].setText(_items.get(position)._time);
return(agntLocator);
}
}
}
By: Parmil.S & Vk Hooda
private Activity activity;
private ArrayList<MessageData> _items;
private LayoutInflater inflater=null;
public ImageLoader imageLoader;
// int count = 10;
public LazyAdapter(Activity a,ArrayList<MessageData> _items) {
activity = a;
this._items=_items;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount() {
return _items.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
class ViewHolder{
public TextView _nametitle,_timedesc;
public ImageView _imageview;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater= activity.getLayoutInflater();
View agntLocator=inflater.inflate(R.layout.msgdetailsrow, null);
String _imgurl = _items.get(position)._image.toString().replaceAll(" ","%20");
Log.d("ddddd","ddddddddd"+_imgurl);
_img[position] = (ImageView)agntLocator.findViewById(R.id._msgrowimg);
//_img[position].setImageBitmap(bmImg);
imageLoader.DisplayImage(_imgurl, this.activity, _img[position]);
_img[position].measure(60,40);
// _img[position].setOnClickListener(new Clickble());
nametxt[position]=(TextView)agntLocator.findViewById(R.id._msgrowname);
nametxt[position].setText(_items.get(position)._sendername);
messagetxt[position]=(TextView)agntLocator.findViewById(R.id._msgrowmessge);
messagetxt[position].setText(_items.get(position)._messdesc);
timetxt[position]=(TextView)agntLocator.findViewById(R.id._msgrowtimefigure);
timetxt[position].setText(_items.get(position)._time);
return(agntLocator);
}
}
}
By: Parmil.S & Vk Hooda
No comments:
Post a Comment