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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:54:18+00:00 2026-06-07T11:54:18+00:00

In my application i am displaying the database in a ListView . In that

  • 0

In my application i am displaying the database in a ListView. In that i have 2 columns. I will retrieve data from database and display in the ListView. My problem is in database after displaying 1st entry it should got to next line and print the next entry, but it is not like that, it is going in column wise. Please help me.

My code is as follows:

ListView lv=(ListView)findViewById(R.id.listView1);  
db.open();
Cursor c = db.getAllTitles();
startManagingCursor(c); 
System.out.println("cursor="+c.getCount());
String[] from = new String[] { db.KEY_INCOME,db.KEY_INCOME};
int[] to = new int[] {R.id.text1 ,R.id.text2,R.id.text3};
SimpleCursorAdapter notes =
      new SimpleCursorAdapter(this, R.layout.columnview, c, from, to);
//    System.out.println("notes="+notes.getCount());
//    setListAdapter(notes);    
lv.setAdapter(notes);    
System.out.println("subbu");
//    System.out.print("tot="+db.add().toString());
String sumtotal=  db.add();      

My main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal">    
    <TextView android:id="@+id/text3"   
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    <ListView
        android:id="@+id/listView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:drawSelectorOnTop="false" >
    </ListView>  
</LinearLayout>

My column.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:paddingTop="4dip"
    android:paddingBottom="6dip"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <TextView android:id="@+id/text1"       
        android:textSize="18sp"
        android:layout_width="30dip"
        android:layout_height="wrap_content"/>
    <TextView android:id="@+id/text2"
        android:textSize="18sp"
        android:layout_width="110dip"
        android:layout_height="wrap_content" 
        android:layout_marginLeft="100dp"
        android:layout_weight="1"/>
    <TextView android:id="@+id/text3"       
        android:textSize="18sp"
        android:layout_width="30dip"
        android:layout_height="wrap_content"/>
</LinearLayout>
  • 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-07T11:54:20+00:00Added an answer on June 7, 2026 at 11:54 am

    Problem:

    The problem is that you have given two columns of db and three TextView of. here

    String[] from = new String[] { db.KEY_INCOME,db.KEY_INCOME};
    int[] to = new int[] {R.id.text1 ,R.id.text2,R.id.text3};
    

    Solution:

    Add another column or remove any TextView‘s id from int[] to, that means the length of String[] from and int[] to should be identical.

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

Sidebar

Related Questions

I have a C#.Net application that accesses data from a commercial application backed by
In my android application I am inserting and displaying data from a SQLite database.
I have an application that has a UILabel displaying the current date and time,
I have with an blue tooth application from android api sample.I am displaying blue
Hi I'm having problem refreshing my listview after Async operation. I have a simplecursoradapter,
I have an application using a MySql database which is displaying a paginated list
I'm designing a Java application using SWT. I have some tables which will display
I have an application that searches text indexed in a MSSQL database. My current
In my application I am displaying text from database in a textview. The text
I'm designing the interface for an application to display some data pulled from a

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.