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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:35:33+00:00 2026-06-15T17:35:33+00:00

I have problem with displaying data in my listview. it’s not displaying vertically. here’s

  • 0

I have problem with displaying data in my listview. it’s not displaying vertically.

here’s my code:

private ListView lv;
private ArrayList<String> results = new ArrayList<String>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.meal_result);
    BreakFastLog info = new BreakFastLog(this);
    info.open();

    String data1 = info.getMealNameData();
    //String data2 = info.getServingData();

    results.add(data1);
    lv = (ListView) findViewById (R.id.lvBF);   
    lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, results));
    lv.setTextFilterEnabled(true); 

    info.close();
}

and my xml

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



    <ListView
        android:id="@+id/lvBF"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />


</LinearLayout>

What’s wrong with this? please help me figure out what makes it displayed horizontally.

Here’s the screenshot:

enter image description here

  • 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-15T17:35:34+00:00Added an answer on June 15, 2026 at 5:35 pm

    After gone through your code,

    You have a only one String value String data1 = info.getMealNameData();
    in your ArrayList<String> results. And results is added to your List Adapter.

    So only one row displayed in your ListView.

    So You have to either make a String[] for all user Inputs instead of your one String data1 and pass that String[] to your List Adapter.

    Update:

    String data1 = info.getMealNameData();
    String[] inputData = data1.split(" ");
    lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, inputData ));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem displaying the results of an sql query into a ListView
I have a problem displaying my Ext.list component. Here is my code: Ext.define(iphone.view.customers.List, {
I have a problem displaying zebra list after filtering results. I have a zebra
I am using HighCharts for displaying some statistical data but i have a problem
I am new to ggplot2 and have problem displaying the regression line for the
I finally managed to get data from facebook! But I have a problem displaying
I have a problem with displaying data from mysql database. My client requires to
I have problem with a UITableview, I'm fetching some data and displaying it in
I have a problem in displaying the data in my application for each week?
I'm encountering a problem with displaying data from the linked list. I have tried

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.