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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:16:55+00:00 2026-05-31T02:16:55+00:00

Does anybody know how to make a button that deletes one character at a

  • 0

Does anybody know how to make a button that deletes one character at a time in an EditText?

I tried the following which is a lame attempt really because I don’t know how to do it:

public void onClick(View v) {
    // TODO Auto-generated method stub
     switch (v.getId()) {
     case R.id.keypad_0:
         edittext.setText(edittext.getText() + "0");
         break;
     case R.id.keypad_1:
         edittext.setText(edittext.getText() + "1");
         break;
     case R.id.keypad_2:
         edittext.setText(edittext.getText() + "2");
         break;
     case R.id.keypad_3:
         edittext.setText(edittext.getText() + "3");
         break;
     case R.id.keypad_4:
         edittext.setText(edittext.getText() + "4");
         break;
     case R.id.keypad_5:
         edittext.setText(edittext.getText() + "5");
         break;
     case R.id.keypad_6:
         edittext.setText(edittext.getText() + "6");
         break;
     case R.id.keypad_7:
         edittext.setText(edittext.getText() + "7");
         break;
     case R.id.keypad_8:
         edittext.setText(edittext.getText() + "8");
         break;
     case R.id.keypad_9:
         edittext.setText(edittext.getText() + "9");
         break;
     case R.id.keypad_minus:
         edittext.setText(edittext.getText() + "-");
         break;
     case R.id.keypad_del:
         edittext.setText(edittext.getText().length() - 1); //attempt here
         break;

If anybody knows please share

  • 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-31T02:16:56+00:00Added an answer on May 31, 2026 at 2:16 am

    If you’re just wanting to remove the last character, the substring method will do nicely:

    edittext.getText().toString().substring(0, edittext.getText().toString().length()-1);
    

    The above code returns the substring of index 0 to the length of the string -1.

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

Sidebar

Related Questions

Does anybody know how to make a jQery function that has more than one
does anybody know how to make a numericupdown control for asp. There's one for
In Oracle, this returns 03/01/2010. That does not make sense to me. Anybody know
Does anybody know how to make a jqGrid resizable? I want that sweet little
Does anybody know how to make a toolbar which style is like top bar
Does anybody know whether it's possible to make a given PowerBuilder application (for which
Does anybody know where I can find a free filter that would make a
Does anybody know that is possible to make the value of tag to dynamic
Does anybody know of a way to make a push button with text on
Does anybody know if there is a way to make autocompletion work in MySQL

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.