Note that there are some explanatory texts on larger screens.

plurals
  1. POcustom ArrayAdapter<new_class> get an error you must supply a resource id for a textview
    primarykey
    data
    text
    <p>here is the code get an error arrayadapter - you must supply a resource id for a textview</p> <pre><code>public class lay extends Activity { public class MyCustomAdapter extends ArrayAdapter&lt;new_class&gt; { private ArrayList&lt;new_class&gt; items; public MyCustomAdapter(Context context, int textViewResourceId, ArrayList&lt;new_class&gt; items) { super(context, textViewResourceId, items); this.items = items; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.row, null); } new_class o = items.get(position); if (o != null) { TextView tt = (TextView) v.findViewById(R.id.text1); TextView bt = (TextView) v.findViewById(R.id.text2); if (tt != null) { tt.setText("Name: "+o.getName()); } if(bt != null){ bt.setText("Status: "+ o.getLink()); } } return v; } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myclass try1 = new myclass(); final List&lt;Map&lt;String, ?&gt;&gt; aaa = try1.type(); //------------------------------------------------------ ArrayList&lt;new_class&gt; my_orders = null; my_orders = new ArrayList&lt;new_class&gt;(); new_class o1 = new new_class(); o1.setName("perspectiva"); o1.setLink("link1"); new_class o2 = new new_class(); o2.setName("perspectiva22"); o2.setLink("link222"); my_orders.add(o1); my_orders.add(o2); ArrayAdapter&lt;new_class&gt; adapter = new ArrayAdapter&lt;new_class&gt;(this, R.layout.row, my_orders); ListView lv = (ListView)this.findViewById(R.id.ListView01); lv.setAdapter(adapter); //------------------------------------------------------ } </code></pre> <p>and the layout row</p> <pre><code>&lt;pre&gt; &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:padding="6dip"&gt; &lt;ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="6dip" android:src="@drawable/icon" /&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"&gt; &lt;TextView android:id="@+id/text1" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="center_vertical" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:id="@+id/text2" android:singleLine="true" android:ellipsize="marquee" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/pre&gt; </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.
 

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