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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:32:47+00:00 2026-05-27T15:32:47+00:00

I have an edittext in my app, which accepts only numbers. It is set

  • 0

I have an edittext in my app, which accepts only numbers. It is set to 0 by default. But when i enters some umbers, i want to overwrite the initial 0 in the left. Now i am having some problem with edittext. For example, when i inserts a 1, i want it to how 1, not 01. my code is like,

    value = (EditText)findViewById(R.id.value);
    value.addTextChangedListener(new TextWatcher() {
        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) 
        {   
            if(arg0.length()==0)
            {
                value.setText("0");
                int i = value.getText().length();
                value.setSelection(i);
            }
        }

        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                int arg3) {
            // TODO Auto-generated method stub
            }

        public void afterTextChanged(Editable arg0) {
            // TODO Auto-generated method stub
        }
    });

How can i achieve it? or is it possible?

  • 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-27T15:32:47+00:00Added an answer on May 27, 2026 at 3:32 pm

    You can set android:hint in your xml file.

    For example,

    <EditText
    android:id="@+id/value"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="0"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my app,in a EditText i have to set dollar sign permanently , always
I am writing a simple android app which have a edittext and a button.
I have an app I'm trying to translate which uses tkinter and python, but
I have an EditText and a Button set next to each other on the
SETUP : I have this app which has 4 activities in a linear path,
Hey i'm trying to build an app in which the user can input some
I have a search app that only has 150 files. So if somebody searches
i have created a login page for some application in android and i want
I'm working on my first android app and have an SQLite database set up
I am working on a android app and I have an EditText where user

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.