Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You must create you ListAdapter. For example:</p> <pre><code>private class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; private Bitmap mIcon1; private Bitmap mIcon2; public EfficientAdapter(Context context) { // Cache the LayoutInflate to avoid asking for a new one each time. mInflater = LayoutInflater.from(context); } /** * The number of items in the list is determined by the number of speeches * in our array. * * @see android.widget.ListAdapter#getCount() */ public int getCount() { return stations.length; } /** * Since the data comes from an array, just returning the index is * sufficent to get at the data. If we were using a more complex data * structure, we would return whatever object represents one row in the * list. * * @see android.widget.ListAdapter#getItem(int) */ public Object getItem(int position) { return position; } /** * Use the array index as a unique id. * * @see android.widget.ListAdapter#getItemId(int) */ public long getItemId(int position) { return position; } /** * Make a view to hold each row. * * @see android.widget.ListAdapter#getView(int, android.view.View, * android.view.ViewGroup) */ public View getView(final int position, View convertView, ViewGroup parent) { // A ViewHolder keeps references to children views to avoid unneccessary calls // to findViewById() on each row. // When convertView is not null, we can reuse it directly, there is no need // to reinflate it. We only inflate a new View when the convertView supplied // by ListView is null. if (convertView == null) { convertView = mInflater.inflate(R.layout.listitem, null); // Creates a ViewHolder and store references to the two children views // we want to bind data to. TextView textView = (TextView) convertView.findViewById(R.id.text1); textView.setText(stations[position]); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. } return convertView; } } </code></pre> <p>This adapter you can use like that:</p> <pre><code>mPlayList.setListAdapter(new EfficientAdapter(ctx)); </code></pre> <p>And how you understand, in R.layout.listitem you can create you button. In method getView - you must process this button.</p> <p><strong>UPD:</strong> Exemple of use Bitmap: You can add this in getView:</p> <pre><code>ImageView im = new ImageView(this); im.setImageBitmap(bitmap); convertView.addView(im); </code></pre>
    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