Note that there are some explanatory texts on larger screens.

plurals
  1. POListView showing parent View and wont take right view?
    primarykey
    data
    text
    <p>I am getting <code>XML</code> from a <code>Restfull</code> service request and need to display it in a <code>listView</code>.</p> <p>I decided to emulate a similar function i found on an online blog and it seems to feed back the original View and not the view format i assign to the elements.</p> <p><img src="https://i.stack.imgur.com/Tye4V.png" alt="error"> </p> <p>Now you can see its duplicated Twice.....After the My Move Contacts bar is where the <code>ListView</code> starts and then duplicates.</p> <p>the XMl for the ListView:</p> <pre><code>&lt;ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/button6" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true" &gt; &lt;/ListView&gt; </code></pre> <p>As well the XML i am using for the Adapter:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left|center" android:paddingBottom="5dp" android:paddingTop="5dp" android:paddingLeft="5dp" &gt; &lt;TextView android:id="@+id/ContactTitle" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"/&gt; &lt;TextView android:id="@+id/Name" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" /&gt; &lt;TextView android:id="@+id/MainPhone" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" /&gt; &lt;TextView android:id="@+id/CellPhone" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" /&gt; &lt;TextView android:id="@+id/Fax" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" /&gt; &lt;TextView android:id="@+id/Email" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>I'm not very good with building these <code>ListViews</code> yet and know its something i did but i cant put my finger on it. Here is my Java for the handling of the data to <code>listView</code>:</p> <pre><code>protected void onPostExecute(String result){ String xml = result; String KEY_ITEM = "Contact"; String KEY_CONTACTTITLE = "ContactTitle"; String KEY_NAME = "Name"; String KEY_MAINPHONE = "Phone"; String KEY_CELLPHONE ="Cell"; String KEY_FAX = "Fax"; String KEY_EMAIL= "Email"; ArrayList&lt;HashMap&lt;String, String&gt;&gt; menuItems = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); Document doc = getDomElement(xml); if (xml != null) { { NodeList nl = doc.getElementsByTagName(KEY_ITEM); for (int i = 0; i &lt; nl.getLength(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); Element e = (Element) nl.item(i); map.put(KEY_CONTACTTITLE, getValue(e, KEY_CONTACTTITLE)); map.put(KEY_NAME, getValue(e, KEY_NAME)); map.put(KEY_MAINPHONE, getValue(e, KEY_MAINPHONE)); map.put(KEY_CELLPHONE, getValue(e, KEY_CELLPHONE)); map.put(KEY_FAX, getValue(e, KEY_FAX)); map.put(KEY_EMAIL, getValue(e, KEY_EMAIL)); menuItems.add(map); } ListAdapter adapter = new SimpleAdapter(MoveContactsActivity.this, menuItems, R.layout.activity_move_contacts, new String[] { KEY_CONTACTTITLE, KEY_NAME, KEY_MAINPHONE, KEY_CELLPHONE, KEY_FAX, KEY_EMAIL }, new int[] { R.id.ContactTitle, R.id.Name, R.id.MainPhone, R.id.CellPhone, R.id.Fax, R.id.Email }); setListAdapter(adapter); } } } </code></pre> <p>Would love it if someone could help me out with this issue or get me pointed in the right direction. Thanks again for you time!</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