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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:56:02+00:00 2026-06-01T11:56:02+00:00

I am new to android developement. I am making a simple expense management program

  • 0

I am new to android developement. I am making a simple expense management program in which there are 2 buttons; one to save the reciever, date and amount records and other button to view these records.Here is the part of the main code that i wrote:

public class database {
public static final String DBNAME = "dbexpense";
SQLiteDatabase db;
DBHandler handler;

public database(Context ctx) {
    handler = new DBHandler(ctx);
}

class DBHandler extends SQLiteOpenHelper {
    public DBHandler(Context ctx) {
        super(ctx, DBNAME, null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("Create table expenses(id integer primary key autoincrement,from text,dated date, amount number );");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("drop table if exists expenses");
        onCreate(db);
    }
}

public void open() {
    db = handler.getWritableDatabase();
}

public void close() {
    db.close();
}
public boolean saveRecord(String from, Date dated, Number amount)
{
    ContentValues cv=new ContentValues();
    cv.put("From", from);
    cv.put("Dated", dated);
    cv.put("Amount", amount);

    return db.insert("expenses", "", cv)>0;
    }

<EditText 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:id="@+id/editText2" 
android:inputType="date">
</EditText>
<EditText 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:id="@+id/editText3" 
android:inputType="number"></EditText>

My xml file has edit text fields for date & number.
This shows an error : The method put(String, String) in the type ContentValues is not applicable for the arguments (String, Date) and The method put(String, String) in the type ContentValues is not applicable for the arguments (String, Number). Is there any other way to save?

  • 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-01T11:56:04+00:00Added an answer on June 1, 2026 at 11:56 am

    Convert your values to the expected format before you try to store them.

    E.g String.ValueOf(number) to convert a number to a string.

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

Sidebar

Related Questions

I am also new to Java and Android Development, been making a simple game
I am new to android development, making a simple game and using onKeyDown(.....) function
I am exploring android and developement and I found one problem. My app UI
I am new to android development. I am creating an android application, in which
I am new to Android development and running into a bizarre issue for which
I am new to android development. Currently i am working on an application which
I'm new in Android development and I have been making a tutorial for a
I am new to Android development and am trying to determine if there is
I am new comer in android developement . I install android sdk in eclipse
I am new to android development . I am making a small email client

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.