Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Have a look at <a href="http://developer.android.com/reference/android/widget/ArrayAdapter.html" rel="nofollow"><code>ArrayAdapter</code></a>. It contains all of the implementation for an Adapter based on an <a href="http://developer.android.com/reference/java/util/ArrayList.html" rel="nofollow"><code>ArrayList</code></a>.</p> <ol> <li><p>Make your adapter a subclass of <a href="http://developer.android.com/reference/android/widget/ArrayAdapter.html" rel="nofollow"><code>ArrayAdapter</code></a>, giving a parametrised type. Yours in this case being <code>Map&lt;String, String&gt;</code></p> <pre><code>public class ResultAdapter extends ArrayAdapter&lt;Map&lt;String,String&gt;&gt; { private int mResource; /** * @param context * @param resource */ public ResultAdapter(Context context, int resource, ArrayList&lt;Map&lt;String,String&gt;&gt; dataList) { super(context, resource, dataList); this.mResource = resource; } ... } </code></pre></li> <li><p>Override the <a href="http://developer.android.com/reference/android/widget/ArrayAdapter.html#getView%28int,%20android.view.View,%20android.view.ViewGroup%29" rel="nofollow">getView</a> method of the ArrayAdapter to use to set the data given to the views.</p> <pre><code>@Override public View getView(int position, View convertView, ViewGroup parent) { View view; // If the view is already inflated, reuse it. // Else inflate the view if (convertView != null) { view = convertView; } else { //inflate view final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(mResource, parent, false); } TextView ATASAN = (TextView) findViewById(R.id.atasan); ... //Get data here Map&lt;String, String&gt; item = getItem(position); //Set data to the View's e.g. ATASAN.setText(item.get("ATASAN")); ... return view; } </code></pre></li> </ol>
 

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