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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:49:49+00:00 2026-05-27T22:49:49+00:00

I have a sqlite db I’m using to store my info and I have

  • 0

I have a sqlite db I’m using to store my info and I have four column headings weighted out to ‘1’. I have a problem reading the data as it bunches it all up in the middle and covers up one of my column headings. What am I doing wrong or is there another way I should be displaying the information? Thanks

Here is the code:

here is the view 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" >

    <TableLayout
        android:id="@+id/tableLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <TableRow >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:text="Date" />

            <TextView
                android:id="@+id/textView2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:text="Time" />

            <TextView
                android:id="@+id/textView3"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:text="Hair Wash" />

            <TextView
                android:id="@+id/textView4"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:text="Comments" />
        </TableRow>

        <TextView
            android:id="@+id/textView3"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="get info from db" />
    </TableLayout>

</LinearLayout>

here is the view java

protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.bathreport);
        TextView tv = (TextView) findViewById(R.id.textView3);
        MyDBAdapter info = new MyDBAdapter(this);
        info.open();
        String data = info.getData();
        info.close();
        tv.setText(data);
    }

My adapter’s getdata

public String getData() {
        String[] columns = new String[] { /*KEY_ROWID,*/ KEY_BATHDATE,
                KEY_BATHTIME, KEY_HAIRWASH, KEY_COMMENTS };
        Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null,
                null, null);
        String result = "\n";
        //int iRow = c.getColumnIndex(KEY_ROWID);
        int iDate = c.getColumnIndex(KEY_BATHDATE);
        int iTime = c.getColumnIndex(KEY_BATHTIME);
        int iHair = c.getColumnIndex(KEY_HAIRWASH);
        int iCom = c.getColumnIndex(KEY_COMMENTS);

        for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
            result = result + /*c.getString(iRow) + " " +*/ c.getString(iDate)
                    + " " + c.getString(iTime) + " " + c.getString(iHair) + " "
                    + c.getString(iCom) + "\n";
        }

        return result;
    }
  • 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-27T22:49:50+00:00Added an answer on May 27, 2026 at 10:49 pm

    I guess a better implementation is to use a SimpleCursorAdapter:

    SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to)
    

    The layout above should contain 4 TextViews in one Horizontal Linear layout (similar to your Table row implementation), the from is your column names and the to is the Ids of the 4 TextViews

    Then set this adapter as the adapter of a ListView that should replace your Table

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

Sidebar

Related Questions

I have a SQLite DB that I'm using to store app data, and I
I have a sqlite (v3) table with this column definition: timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
I have an SQLite database, eventually will be a MySQL database and I'm using
I have created sqlite database using phonegap. I am able to access that databse
I have an sqlite string column that is assigned to a string. I need
I have an sqlite database I am writing and reading from. Most of the
I have 2 sqlite files, one is older, another one has some new data
I have SQLite Database(DB) and made this to model class and taken the data
I have a SQLite database. Should I put the DB in a data structure
I have SQLite database and I have in it certain column of type double.

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.