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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:10:32+00:00 2026-05-25T21:10:32+00:00

I have an EditText with android:maxLength=17 and used buttons with onClickListener to update text

  • 0

I have an EditText with android:maxLength=”17″ and used buttons with onClickListener to update text of this EditText the process here is that when the text length reaches to 16 the EditText animate’s towards left with distance of approx one character using TranslateAnimation(0, -15, 0, 0); and then the first character of EditText is being removed. for this first i call the method to perform animation and then call method to remove the the first characer like shown below

animate();

removeChar();

The problem here is that before the end of animation the character got removed, means while the animation is running the removeChar() completes its functionality while i want the removeChar() to perform its functionality after animation ends.

when i googled for this i found answer to use animation listener but while writing code in Eclips i don’t found any animation listener for the object

the methods have no error and perform their functionality accurate as i want. the code for methods is show below

 public void animate()
{
                //slide is declared at class level
                slide = new TranslateAnimation(0, -15, 0,0 );   
                slide.setDuration(1250);   
                slide.setFillAfter(true);   
                myEditText.startAnimation(slide);
}


public void removeChar()
{           
    String update="";
    for(int i=1 ; i < myEditText.getText().toString().length() ; i++)
    {
        update=update+input.getText().toString().charAt(i);
    }
    myEditText.setText(update);
}

I have also tried to use the code below to wait for end of animation but it halts the application .

            animate();
            //slide is declared at class level
            while(!(slide.hasEnded()))
               {
                    // Just waste the time
               }
            removeChar();

i think the application halts because all processing goes for while loop and animation doe’nt gots ended and hence loop becomes an infinite loop and causes application to halt

i searched a lot and found no proper answer plz help me and i will prefer a code snippet or a little example as I’m new to android plz really need help…

  • 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-25T21:10:33+00:00Added an answer on May 25, 2026 at 9:10 pm

    Attach an AnimationListener to your animation and then execute removeChar() in the onAnimationEnd() method. Like this:

    slide.addAnimationListener(new AnimationListener(){
        public void onAnimationStart(Animation a){}
        public void onAnimationRepeat(Animation a){}
        public void onAnimationEnd(Animation a){
            NameOfParentClass.this.removeChar();
        }
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Edit Text that is defined as follows. <EditText android:layout_width=fill_parent android:layout_height=wrap_content android:maxLines=1
I have layout with two Plain Text. This is code: <EditText android:id=@+id/editTextName android:layout_width=120dp android:layout_height=wrap_content
<EditText android:layout_width=wrap_content android:layout_height=wrap_content android:layout_weight=1 android:id=@+id/name android:singleLine=true android:maxLength=12 android:capitalize=none android:inputType=text /> <Button android:layout_width=wrap_content android:layout_height=wrap_content android:id=@+id/search_button
In my xml i have an edittext element like this <EditText android:id=@+id/hrvalue android:layout_width=wrap_content android:layout_height=wrap_content
I have this EditText definition: <EditText android:layout_height=wrap_content android:layout_width=fill_parent android:inputType=textEmailAddress android:id=@+id/EmailText/> Notice the EditText has
I have a very simple EditText, as follows: <EditText android:id=@+id/myedit android:layout_width=fill_parent android:layout_height=wrap_content android:singleLine=true android:maxLength=32/>
I have an EditText with android:inputType=phone keybord. There is an OK on this keyboard.
I have EditText in my XML as <!-- Inside RelativeLayout --> <EditText android:id=@+id/edtEmail android:layout_width=match_parent
I have a EditText view, <EditText android:layout_weight=1 android:id=@+id/etMiktar android:layout_width=0dp android:layout_height=wrap_content android:hint=@string/miktarHint android:focusable=false> </EditText> And
I have an Activity in Android, with two elements: EditText ListView When my Activity

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.