Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to inflate Quick contact badge in android using Layout inflater?
    primarykey
    data
    text
    <p>I am unable to inflate a xml(layout containing QuickContactBadge) file using LayoutInflater, to use it inside ListView. It is not producing either compile/run time error or proper expected output. After I removed QuickContactBadge from XML Layout file, It gets inflated properly. How to solve this issue?</p> <ol> <li>Is it possible to inflate a XML layout file which have QuickContactBadge?</li> <li>If it is possible, What is the correct procedure to inflate a XML layout file which have QuickContactBadge, to use inside ListView?</li> </ol> <p>Edit</p> <p>message_item.xml <code></p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/lLayoutMessageItemHolder" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;QuickContactBadge android:id="@+id/quickContactBadge1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;LinearLayout android:id="@+id/lLayoutContentDisplayHolder" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/tvPerson" android:textIsSelectable="false" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/strPerson" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/tvMessage" android:textIsSelectable="false" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/strLastMessage" /&gt; &lt;TextView android:id="@+id/tvTime" android:textIsSelectable="false" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/strLastMessageReceivedTime" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p></code></p> <p>Edit: Updated code And getView() method of ContactListAdapter.java</p> <p><code></p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub //return super.getView(position, convertView, parent); if(context != null){ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View linearLayout = inflater.inflate(R.layout.message_item, null); Contact contact = (Contact)getItem(position); TextView tvPerson = (TextView)linearLayout.findViewById(R.id.tvPerson); tvPerson.setText("Sample Text"); Log.i("Test","Sample Text"); return linearLayout; }else{ return null; } } </code></pre> <p></code></p> <p>Console Output:</p> <p><code></p> <pre><code>07-10 17:00:26.511: I/Test(3574): Sample Text 07-10 17:00:26.611: I/Test(3574): Sample Text 07-10 17:00:26.621: I/Test(3574): Sample Text 07-10 17:00:26.641: I/Test(3574): Sample Text 07-10 17:00:26.661: I/Test(3574): Sample Text 07-10 17:00:26.691: I/Test(3574): Sample Text 07-10 17:00:26.701: I/Test(3574): Sample Text </code></pre> <p></code></p> <p>P.S: Am not setting values for all the widgets used in that layout. I expected the list with only person name but It is not producing any error while compiling and also while running. But it displays only empty screen.</p>
    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.
 

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