What is a TEXTWATCHER in ANDROID ?

Posted by Unknown Jumat, 19 April 2013 0 komentar
TextWatcher is used to keep watch on EditText while entering data into it. We can perform
operation and keep watch on which characters are being entered or how many characters are
being entered in the EditText.  

Text Watcher has three events.
 1.beforeTextChanged : This means that the characters are about to be replaced with some
 new text. The text is uneditable. This event is used when you need to take a look at the old
 text which is about to change.

 2.onTextChanged: Changes have been made, some characters have just been replaced.
The text is uneditable. This event is used when you need to see which characters in the
text are new.

 3.afterTextChanged : The same as above, except now the text is editable. This event is
used when you need to see and possibly edit new text.  
Java source code is given below
 
EditText myedittext;
myedittext = (EditText)findViewById(R.id.edittext);
myedittext.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s)
{
}

public void beforeTextChanged(CharSequence s, int start,
int count, int after)
{
}

public void onTextChanged(CharSequence s, int start,
int before, int count)
{
}
});
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: What is a TEXTWATCHER in ANDROID ?
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke http://androidpopuler.blogspot.com/2013/04/what-is-textwatcher-in-android.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.