Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should create a view for the list as you like it to be, here is example.</p> <p>home.xml </p> <pre><code>&lt;ListView android:id="@+id/listView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/alert_dark_frame" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p>and one more xml which you have to inflate, list.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p></p> <pre><code>&lt;TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TextView" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>in your activity use this method,</p> <pre><code>LayoutInflater mlayoutinflator; public void getlist(final ArrayList&lt;contact&gt; list){ // Get the list view ListView listView = (ListView) findViewById(R.id.listView); mlayoutinflator =(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); ArrayAdapter&lt;contact&gt; aa = new ArrayAdapter&lt;contact&gt;(this, R.layout.listitem,list){ @Override public View getView(final int position, View convertView,ViewGroup parent) { if (null == convertView) { convertView = mlayoutinflator.inflate(R.layout.listitem, parent, false); holder = new ViewHolder(); holder.value1 = (TextView)convertView.findViewById(R.id.textView1); holder.value2 = (TextView)convertView.findViewById(R.id.textView2); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.value1.setText(""+list.get(position).getName().trim()); holder.value2.setText(""+list.get(position).getNumber().trim()); convertView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("sms:")); intent.putExtra( "sms_body", list.get(position).getName()+"-"+list.get(position).getNumber() ); startActivity(intent); } }); return convertView; } }; listView.setAdapter(aa); } static class ViewHolder { private TextView value1; private TextView value2; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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