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

  • Home
  • SEARCH
  • 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 8738543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:45:12+00:00 2026-06-13T10:45:12+00:00

My name is Michael, and I am writing an android application that will serve

  • 0

My name is Michael, and I am writing an android application that will serve as a very basic class schedule app. So far, I have been able to write the program so that I am able to create and add new classes to the database, however I cannot seem to figure out how to remove a selected entry from the database. The button that saves the entries is defined as follows:

<Button
        android:id="@+id/save"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Save" />

and the listener that it activates is:

private View.OnClickListener onSave=new View.OnClickListener() {
        public void onClick(View v) {
            String type=null;

            switch (types.getCheckedRadioButtonId()) {
                case R.id.math:
                    type="math";
                    break;
                case R.id.cs:
                    type="cs";
                    break;
                case R.id.pe:
                    type="pe";
                    break;
                case R.id.elective:
                    type="elective";
                    break;
            }

            if (restaurantId==null) {
                helper.insert(name.getText().toString(),
                                            address.getText().toString(), type,
                                            notes.getText().toString());
            }
            else {
                helper.update(restaurantId, name.getText().toString(),
                                            address.getText().toString(), type,
                                            notes.getText().toString());
            }

            finish();
        }
    };

Where the ‘insert()’ method is the function in my helper class that adds the entry.

The specific problem is that I am having trouble writing the ‘remove()’ function in the helper class. I have tried using the getWritableDatabase.delete() function, however I am having trouble finding the right parameters. Any point in the right direction would be a big help to me. Thank you in advance.

If it helps at all, this is the insert() function:

public void insert(String name, String address,
            String type, String notes) {
        ContentValues cv=new ContentValues();

        cv.put("name", name);
        cv.put("address", address);
        cv.put("type", type);
        cv.put("notes", notes);

        getWritableDatabase().insert("restaurants", "name", cv);
    }
  • 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-13T10:45:13+00:00Added an answer on June 13, 2026 at 10:45 am

    Are you interested in something like this?

    public void deleteValue(String value)
        {
             SQLiteDatabase db = getWritableDatabase();
    
             String whereClause = "name"+"=?";
             String[]whereArgs = new String[] {String.valueOf(value)};
              db.delete(TABLE_NAME, whereClause, whereArgs);
              db.close();
              Log.v("done","deleted  row ");
        }
    

    Here the parameter value for the deleteValue() is the one on which basis we are willing to delete a row (like delete rows based on the name) so we are using it as where clause.

    see the lines

    String whereClause = "name"+"=?";
                 String[]whereArgs = new String[] {String.valueOf(value)};
    

    This can be assumed as delete statement with where clause as where name = value;

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

Sidebar

Related Questions

I have a textfield which takes in full name example: michael peter johnson in
I have the following text; country=france name=jean country=germany name=michael country=england name=jack I want it
Name: <%= Html.TextBox(txtName, 20, new { @class = hello }) %> I want that
I created and love my Asp.Net MVC2 application. It's a very nice DDD app
I have user table ID Name 1 Michael 2 Jimmy if i do a
Suppose we have string like this: Hello, my\n name is Michael. How can I
I am writing a Java class that parses log files. The compiled .class file
The name says it all really. I suspect that insertion sort is best, since
The name says it all, but to elaborate I have a list of vectors
Imagine you have a map like this: (def person { :name { :first-name John

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.