Hey
u need to implement like -
private static class EfficientAdapter extends BaseAdapter
{
private LayoutInflater mInflater;
public EfficientAdapter(Context context)
{
mInflater = LayoutInflater.from(context);
}
public int getCount() {
return country.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup
parent)
{
ViewHolder holder;
if (convertView == null)
{
convertView = mInflater.inflate(R.layout.listview, null);
//convertView.setMinimumHeight(list_height/2);
holder = new ViewHolder();
//holder.check =
(CheckBox)convertView.findViewById(R.id.Checkbox);
holder.from = (TextView)
convertView.findViewById(R.id.from);
holder.subject = (TextView)
convertView.findViewById(R.id.subject);
holder.date = (TextView)
convertView.findViewById(R.id.mail_date);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}
System.out.println("position ="+position);
System.out.println("Test " +inbox_mail[position].getName());
System.out.println("inbox getDate
="+inbox_mail[position].getDate());
holder.from.setText(inbox_mail[position].getName());
holder.subject.setText(inbox_mail[position].getSubject());
holder.date.setText(inbox_mail[position].getDate());
return convertView;
}
static class ViewHolder
{
CheckBox check;
TextView from;
TextView subject;
TextView date;
}
}
2010/9/24 Kostya Vasilyev <[email protected]>
> You need to make your own adapter class, override getView, and do your
> per-item list customization there. Also you should not need to call
> setContentView for any of this - call it just once in the activity's
> onCreate with the top-most layout's id.
>
> You should also be able to put your RelativeLayout into the list item's
> layout XML file. Once you have a reference to the text view inside the list
> item's view (in getView), set its contents using the data in the array.
> That's what ArrayAdapter does, but you need more than it can provide (the
> font).
>
> --
> Kostya Vasilyev -- http://kmansoft.wordpress.com
>
> 24.09.2010 0:22 пользователь "intbt" <[email protected]> написал:
>
>
> Yeah I think I am doing both of those suggestions. I left a few lines
> of code out of my original message.
>
> This code sits before the TextView declaration and v is the listview
> layout
>
> myLayout.addView(vt);
>
> myLayout.addView(v);
>
> setContentView(myLayout);
>
> So I thought this instruction:
>
> Type =(TextView) v.findViewById(R.id.type);
> >
> > Typ...
> would call the specific findViewById for the view v?
>
> Am I missing something else?
>
> Appreciate the suggestions,
>
> intbt
>
>
> On Sep 23, 12:19 pm, Kostya Vasilyev <[email protected]> wrote:
> > Item views don't exist until cre...
> > 23.09.2010 23:08 пользователь "intbt" <[email protected]> написал:
>
> >
> > Perhaps you guys can also assist me with my custom listview problem.
> > The listview is part of a...
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" g...
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
Thanks & Regards
Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030273740
(R) +919886336619
--
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