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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:18:53+00:00 2026-06-13T13:18:53+00:00

The Android documentation implies that I should prefer to use XML when declaring the

  • 0

The Android documentation implies that I should prefer to use XML when declaring the UI: http://developer.android.com/guide/topics/ui/declaring-layout.html

Regardless of whether you agree that it implies this, my personal preference is to use XML when possible.

However, for ListView the documentation only explains how to populate it programmatically: http://developer.android.com/guide/topics/ui/layout/listview.html

How do I, say, create a ListView with three elements using only the XML layout file? Is this impossible or undesirable?

Being used to developing for the Desktop, I am not accustomed to being required to manually create elements of UI containers, so I am confused as to whether I am missing something or things are different in Android.

  • 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-06-13T13:18:54+00:00Added an answer on June 13, 2026 at 1:18 pm

    ListView and similar Views will, in general, receive data coming from a dynamic source (like a SQLite database). In that case, the only way to populate it is programmatically.

    However, if you have a static list of elements, you can populate it via XML with the following attribute: android:entries. The value would be an array resource.

    Example:

    <ListView 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:entries="@array/your_array"
    />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Android documentation here http://developer.android.com/guide/topics/resources/localization.html explains that you can get the current locale with
In the Android documentation here: http://developer.android.com/guide/components/fragments.html A Fragment implements an interface. In the onAttach()
The documentation shows the orientation of the Axes: http://developer.android.com/reference/android/hardware/SensorEvent.html But it doesn't specify where
I was reading this documentation page, http://developer.android.com/reference/android/util/Log.html . The section here caught my eye:
When producing an Android build the android documentation states that you should zipalign only
I know that there is code like this: http://www.java2s.com/Code/Android/Security/RSAencryptdecryptfunctionRSAECBPKCS1Padding.htm /* Copyright (c) 2010, Sungjin
The Android documentation says that best practices are to make two drawable directories -
The Android Developer documentation does not mention whether the method below (and similar ones)
In the Android SDK documentation, all of the examples used with the @drawable/my_image xml
I want to have a full documentation for android ndk. or a url that

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.