Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Why do you have the <em>getCount()</em> method, which should return a int value throwing an exception? That seems preety awkward. Instead of you should do:</p> <pre><code>public int getCount() { return yourDataArray.size(); } </code></pre> <p>That method is responsible for the number of lines that your ListView will going to have, ie, if <em>yourDataArray</em> has a size = 7 this means you will have 7 lines in the ListView.</p> <p><strong>EDIT:</strong></p> <p>Here is your solution:</p> <ol> <li><p>Replace getItem() method with:</p> <pre><code> public Object getItem(int arg0) { return arg0; } </code></pre></li> <li><p>Replace your adapter getView() method with the code below.</p> <pre><code>@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; ViewHolder holder; if (v == null) { LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = vi.inflate(R.layout.layout_favorites_row, null); ImageView map_image = (ImageView) rowView.findViewById(R.id.route_image); TextView map_title = (TextView) rowView.findViewById(R.id.route_title); TextView map_author = (TextView) rowView.findViewById(R.id.route_author); TextView map_length = (TextView) rowView.findViewById(R.id.route_length); ImageView map_image_arrow = (ImageView) rowView.findViewById(R.id.route_arrow); v.setTag(holder); } else { holder=(ViewHolder)v.getTag(); } /** Define here the values to all the Views of the ViewHolder. */ holder.map_image.setBackgroundDrawable(drawables[position]); holder.map_title.setText(titles[position]); holder.map_author.setText(authors[position]); holder.map_length.setText(durations[position]); holder.map_image_arrow.setBackgroundDrawable(d); return v; } </code></pre> <p>Use a ViewHolder. Be sure you define a ViewHolder inner class like:</p> <pre><code>public static class ViewHolder { public TextView map_image ; public TextView map_title; public TextView map_author; public TextView map_length; public ImageView map_image_arrow; } </code></pre></li> </ol>
    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. VO
      singulars
      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