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 6711845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:11:22+00:00 2026-05-26T08:11:22+00:00

I am trying to display some items in a listview, which is located in

  • 0

I am trying to display some items in a listview, which is located in a relativelayout.
The whole layout is located in one xml file (main.xml)

The layout has also 2 buttons and 2 more textfields (EditText).

I can`t get it to work, as:

  1. The listview does not show the items

  2. If the listview expands, it duplicates the buttons and textfields present in the layout

can someone please help me?

Here is a part of the 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"
 android:background="@drawable/kpnback">

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

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

 <ListView 
  android:layout_width="fill_parent" 
  android:layout_height="20dp"
  android:id="@+id/kpn" 
  android:layout_y="350dp"
  android:layout_below="@+id/editText1">
 </ListView> 
</RelativeLayout> 

Code for the simpleadapter:

@Override 
    protected void onPostExecute(String result) { 
        // 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 };

        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)"); 

        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);
  • 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-26T08:11:22+00:00Added an answer on May 26, 2026 at 8:11 am

    1) Do not use “@+id/…” for the layout_below attribute.. Instead use “@id/…”

    2) lbl_top is not present inside the RelativeLayout..

    3) You’ll have to specify layout_toLeftOf or layout_toRightOf, apart from specifying layout_below.

    Hope this helps..

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

Sidebar

Related Questions

I am trying to read in a file that has HTML list items with
I am trying to display some xml data from remote URL using jquery and
I am trying to display a multiple select that is disabled and has some
I'm trying to display items from a database into a listview for all dates
I've been trying for a while to display some data in a listbox/listview that
I'm trying to display some large images with HTML img tags. At the moment
I am trying to display some message in span. but it is not working.
Right now, what i'm trying to do is display some lists on a page
I'm trying box up a list of elements and display a some text below
I am trying to make some animations with the main navigation of my site.

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.