Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6732535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:39:45+00:00 2026-05-26T10:39:45+00:00

I`m realy getting frustrated, I am trying to show some items from a XML

  • 0

I`m realy getting frustrated,

I am trying to show some items from a XML file which i parsed but i can`t get them to show in my listview.
Can anyone please help me to get this done?

Please provide some examplecode if possible, so that i can follow, as i pretty new to this.

Thank you in advance.

My code:

@Override 
    protected void onPostExecute(String result) { 
        //publishProgress(false); 
        // create the grid item mapping
        ListView kp = (ListView)findViewById(R.id.kpn);

        String[] from = new String[] {"col_1", "col_2"};
        int[] to = new int[] { R.id.editText1, R.id.editText1 }; // 2 EditText fields

        List<HashMap<String, String>> fillMaps = new ArrayList<HashMap<String, String>>();
        HashMap<String, String> map = new HashMap<String, String>();

        Document doc = Jsoup.parse(kpn);
        Elements tdsFromSecondColumn = doc.select("table.personaltable td:eq(0)");
        Elements tdsFromSecondColumn1 = doc.select("table.personaltable td:eq(1)"); 

        // Fill the HashMaps
        for (Element tdFromSecondColumn : tdsFromSecondColumn) {
            map.put("col_1", tdFromSecondColumn.text()); 
            fillMaps.add(map);

            System.out.println(tdFromSecondColumn.text()); 

        } 
        for (Element tdFromSecondColumn1 : tdsFromSecondColumn1) {
            map.put("col_2", tdFromSecondColumn1.text());
            fillMaps.add(map);

            System.out.println(tdFromSecondColumn1.text());
        }

        SimpleAdapter adapter = new SimpleAdapter(AndroidLogin.this, fillMaps, R.layout.main, from, to); 
        kp.setAdapter(adapter);

My layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">

<ListView 
 android:layout_width="fill_parent" 
 android:layout_height="100dp"
 android:id="@+id/kpn" 
 android:layout_y="350dp">
</ListView> 

<EditText 
 android:inputType="textMultiLine" 
 android:id="@+id/editText1" 
 android:layout_height="wrap_content" 
 android:text="edit1" 
 android:layout_width="110dp">
</EditText> 

<EditText 
 android:layout_height="wrap_content" 
 android:layout_width="110dp" 
 android:id="@+id/editText2" 
 android:text="edit2"
 android:inputType="textMultiLine"
 android:layout_marginLeft="50dp"
 android:layout_below="@+id/lbl_top"
 android:layout_toRightOf="@+id/editText1">
</EditText>

<RelativeLayout android:id="@+id/LinearLayout01"  
 android:layout_below="@+id/kpn"  
 android:layout_width="fill_parent"  
 android:layout_height="wrap_content"  
 android:layout_alignParentBottom="true"> 

<TextView 
 android:layout_height="wrap_content" 
 android:layout_width="wrap_content" 
 android:text="User Name" 
 android:id="@+id/lbl_username">
</TextView>

<TextView 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:text="Password" 
 android:id="@+id/lbl_password" 
 android:layout_marginLeft="160dp">
</TextView>

<EditText  
 android:id="@+id/txt_username" 
 android:layout_width="120dp" 
 android:layout_height="wrap_content" 
 android:textSize="18sp"
 android:layout_below="@+id/lbl_username">
</EditText> 

<EditText 
 android:layout_height="wrap_content" 
 android:layout_width="120dp" 
 android:id="@+id/txt_password" 
 android:password="true" 
 android:textSize="18sp"
 android:layout_marginLeft="160dp"
 android:layout_below="@+id/lbl_password">
</EditText> 

<Button 
 android:layout_height="wrap_content" 
 android:layout_width="100px" 
 android:id="@+id/btn_login" 
 android:text="Login" 
 android:layout_below="@+id/txt_username">
</Button> 

<Button 
 android:layout_height="wrap_content" 
 android:layout_width="100px" 
 android:id="@+id/cancel_button" 
 android:text="Cancel" 
 android:layout_marginLeft="160dp"
 android:layout_below="@+id/txt_password">
</Button> 

<TextView 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:textSize="14sp"
 android:text="Label result"  
 android:id="@+id/lbl_result"
 android:layout_below="@+id/btn_login">
</TextView> 

<TextView android:lines="6" 
 android:layout_height="20dp" 
 android:layout_width="wrap_content" 
 android:typeface="sans" 
 android:maxLines="12" 
 android:text="Please Loggin First" 
 android:id="@+id/lbl_top" 
 android:textSize="14sp"
 android:layout_below="@+id/lbl_result">
</TextView> 

</RelativeLayout>
</RelativeLayout> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:39:46+00:00Added an answer on May 26, 2026 at 10:39 am

    You can’t include editText1 and editText2 in your main layout file. When using a listview, you specify the layout for each row in a seperate file. Like so

    list_view_row.xml

    <?xml version="1.0" encoding="utf-8"?>
      <LinearLayout android:orientation="horizontal"
        android:width="fillParent"
        android:height="fillParent"
      />
    
    <EditText>
     android:inputType="textMultiLine" 
     android:id="@+id/editText1" 
     android:layout_height="wrap_content" 
     android:text="edit1" 
     android:layout_width="110dp">
    </EditText> 
    
    <EditText>
     android:layout_height="wrap_content" 
     android:layout_width="110dp" 
     android:id="@+id/editText2" 
     android:text="edit2"
     android:inputType="textMultiLine"
     android:layout_marginLeft="50dp"
    </EditText>
    
    </LinearLayout>
    

    You then do:

        SimpleAdapter adapter = new SimpleAdapter(AndroidLogin.this, fillMaps, R.layout.list_view_row, from, to);
    

    Checkout this tutorial for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Arghhh! I'm getting so frustrated trying to get my head around this WCF service.
I'm getting really frustrated as I'm trying to get an array to my _Click-Event
I'm really frustrated with getting going using VIM. I'm just trying to do some
I'm getting increasingly frustrated with Flex's Dictionary (which is really just an array with
I'm getting ready to implement a source control system (subversion) but I'm facing some
I'm getting really frustrated about SQL Server. I'm just trying to join 3 tables,
I'm getting really frustrated with synchronizing in netbeans (v6.9) - I can't fathom out
Not really getting the point of the map function. Can anyone explain with examples
Sorry if this is a really basic question but it's been really getting to
Well it's not realy causing any errors. Anyways i'm sending ajax request and getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.