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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:35:08+00:00 2026-05-29T05:35:08+00:00

I have a table called tbl_homework. There are 3 columns called _id, hw and

  • 0

I have a table called tbl_homework. There are 3 columns called “_id”, “hw” and “hwdate”.
Now I like to read out “hw” AND “hwdate”. So I like it on the same line in this listview.
I have to say that it is working without crash or error. It just don’t show the date…
Following picture will tell you what I mean:

enter image description here

Here are the code snippets to tell you how I tried this:

    private Button.OnClickListener add_hw = new Button.OnClickListener(){
    public void onClick(View arg0) {
        mDbHelper.open_database_rw();
        String txt_insert_hw = insert_hw.getText().toString(); 

        if(txt_insert_hw.equals("")){
            doMessage("Keine Eingabe!");
        }else{
            String date_picker_message= date_pick.getDayOfMonth() + "/" + (date_pick.getMonth()+1) + "/" + date_pick.getYear();
            final String INSERT_HW = "INSERT INTO tbl_homework ('hw', 'hwdate') VALUES ('"+txt_insert_hw+"', '"+date_picker_message+"')";
            db.execSQL(INSERT_HW);
            insert_hw.setText("");
            fillData();
        }
    }
};


    private void fillData() {
    // Get all of the notes from the database and create the item list

    Cursor c = mDbHelper.fetchAllNotes();

    startManagingCursor(c);

    String[] from = new String[] { dbHelper.KEY_TITLE, dbHelper.KEY_DATE};
    int[] to = new int[] {R.id.txt_notes_row};

    // Now create an array adapter and set it to display using our row
    SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
        setListAdapter(notes);
    }

And in mDbHelper:

    public Cursor fetchAllNotes() {
    return db.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE, KEY_DATE}, null, null, null, null, null);
}

Soulution of this problem: (Received from Jury)

    String[] from = new String[] { dbHelper.KEY_TITLE, dbHelper.KEY_DATE};
    int[] to = new int[] {R.id.txt_notes_row, R.id.txt_notes_row2};

I had to add a new TextView. dbHelper.KEY_TITLE AND dbHelper.KEY_DATE coudn’t be handle by one TextView. So I had to add a new TextView to handle the second part of my String “from”.

  • 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-29T05:35:09+00:00Added an answer on May 29, 2026 at 5:35 am

    I think the problem is that you try to match two columns (from) to only one container (to) here:

    String[] from = new String[] { dbHelper.KEY_TITLE, dbHelper.KEY_DATE};
    int[] to = new int[] {R.id.txt_notes_row};
    

    You should specify two fields in the list row where you store your values. I.e. your R.id.txt_notes_row should contain two widgets (for instance, R.id.txtview1 and R.id.txtview2) where you can store your values from db.

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

Sidebar

Related Questions

I have table called Direccion other called Cliente each one defined like this public
I have a Table called Product and I have the Table StorageHistory . Now,
I have a table called ProjectRegion. It has two columns, an id and a
I have table called Reporting with following columns OutletId CampaignId ItemId Qty 10 1
I have a table called tbl_users A broken down version of it for this
Ok, I have one JavaScript that creates rows in a table like this: function
I have a table called dbo.Tbl_ActivityInformations and the data look like Activityid activitymaxcount Activityusedcount
I have table called product review with columns productreviewid , productid , shopperid ,
I have a table called tbl_AllowedIpRange with the columns: ipFrom | ipTo I have
i have a table called tbl_products and i want to combine the columns start_date

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.