Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I alwas use a custom Adapter with a viewholder like:</p> <pre><code>public class CalendarAdapter extends BaseAdapter { protected static CalViewHolder holder; private LayoutInflater mInflater; public HashMap&lt;Integer,String[]&gt; appointments = new HashMap&lt;Integer,String[]&gt;(); public CalendarAdapter(Context context,HashMap&lt;Integer,String[]&gt; set_appointments) { // Cache the LayoutInf mInflater = LayoutInflater.from(context); appointments = set_appointments; } @Override public int getCount() { // TODO Auto-generated method stub return appointments == null ? 0:appointments.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.xml.appointment, null); holder = new CalViewHolder(); holder.app_lay = (LinearLayout) convertView.findViewById(R.id.appointment_layout); holder.app_head = (TextView) convertView.findViewById(R.id.appointment_head); holder.app_body = (TextView) convertView.findViewById(R.id.appointment_body); convertView.setTag(holder); }else{ holder = (CalViewHolder) convertView.getTag(); } holder.app_head.setText(appointments.get(position)[0]); holder.app_body.setText(appointments.get(position)[1]); return convertView; } static class CalViewHolder { LinearLayout app_lay; TextView app_head; TextView app_body; } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload