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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:01:17+00:00 2026-05-23T14:01:17+00:00

I am creating my first android app, and now struck on a weird issue

  • 0

I am creating my first android app, and now struck on a weird issue

Here is the situation:
The user can enter a numeric value for any given date.

Issue:
So when user tries to give another score for the same date, as we all know the app should over write the old value and update the new value the user just gave.

So I have a update method that gets the rowId and overwrites old values by new. but what’s happening in my table is scary. When I update a numeric value for the same date say 6/6/2011. it creates another record, now I have 2 entries on same date one is old and one is new. and then when i do it to some other date say 6/7/2011(like give a value for a date and then update it) the duplicate column created for 6/6/2011 is gone and a duplicate column is created for 6/7/2011.

updateValue(...){

    ContentValues args = new ContentValues();
    args.put(KEY_DATESTAMP_SUBTABLE, day);
    args.put(KEY_HABIT, habit);
    args.put(KEY_USER_SCORE_SUBTABLE, userScore);
    args.put(KEY_CALCULATED_SCORE_SUBTABLE,
            calculateCompoundScore(scoringMethod, userScore, importance));
    String whereClause = KEY_ROWID + "=" + rowId;

    return mDb.update(SCORE_TABLE, args, whereClause, null) > 0;

}

can anybody explain me this behavior!!!!

I edited and added the code:

edited:
I found the problem, it is a dumb mistake, the rowID is the row id of a different table, so every time i delete using that it gives me wild results. It is my bad..BUt @Alex idea helped me to figure it out as for update as he said, i deleted first and then inserted, while doing this i found it is deleting some other row.

Thanks

  • 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-23T14:01:17+00:00Added an answer on May 23, 2026 at 2:01 pm

    Like gopal said, would be nice to see some code.

    Regardless, couldn’t you just delete the old entry and add a completely new one into the table?

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

Sidebar

Related Questions

I'm creating my first android app (or attempting to anyway) and i have a
I'm creating an Android app, where the user starts out seeing a list of
I'm creating an Android app, when a user clicks a button in the app
I'm creating my first android app and I need to use a service. The
I'm creating my first app for Android device and I was faced with a
I am working on my first ever android app, and I'm creating basic exercise/calorie
I'm creating my first android app that will make use of SQlite. I have
I am creating a replacement Car Home app for Android 2.0+ devices. The app
I am creating an Android app (API 8) that need to receive a lot
I'm creating android app that has table layout for the main activity, and 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.