Friday 15 June 2012

Delete SPACE from EditText(User cant add space in beginning in edittext if user presses space)


Step-1: Add "implements TextWatcher" after Activity
eg. public class AddMoreWebsite extends Activity implements TextWatcher {


Step-2:Now Put Cursor on Red line error and Add UnImplemented methods of TextWatcher.
Eg. it Will add following Methods


public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
String result = s.toString().replaceAll(" ", "");
if (!s.toString().equals(result)) {
et_AddMoreSite.setText(result);
et_AddMoreSite.setSelection(result.length());


}
}


public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub


}


public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub


}


Step-3: Now Add following lines in afterTextChanged(...)


String result = s.toString().replaceAll(" ", "");
if (!s.toString().equals(result)) {
et_AddMoreSite.setText(result);
et_AddMoreSite.setSelection(result.length());




Step-4: Now Put this line in onCreate() after your editText declaration.


et_AddMoreSite.addTextChangedListener(this);




Ref. Link: http://stackoverflow.com/questions/9757991/how-to-delete-instantly-space-from-an-edittext-if-a-user-presses-the-space


Enjoy.....

13 comments:

Anonymous said...

Hey I know this is off topic but I was wondering if you knew of any widgets
I could add to my blog that automatically tweet my newest twitter updates.
I've been looking for a plug-in like this for quite some time and was hoping maybe you would have
some experience with something like this. Please let me know if you run into anything.

I truly enjoy reading your blog and I look forward to
your new updates.

Feel free to visit my blog posthere sharecash bypass ()

Anonymous said...

"The previous year was all about the i - Phone 5 despite its late release. In this write-up, we will focus on these messages more and what can be performed with them. When your wireless router is sending and receiving signals to and from your computer, the shield can help block out interference that is "behind" it - maybe even something unknown coming from a neighbor's apartment.

Here is my homepage asus rt-n66w

Anonymous said...

Hello everyone, it's my first pay a quick visit at this web site,
and post is in fact fruitful in favor of me, keep up posting these types
of articles.

- cliquez ici
- cliquez ici
- cliquez ici
- cliquez ici
- cliquez ici
- cliquez ici

Feel free to surf to my web-site - cliquez ici

Anonymous said...

Congratulations on your recent pɑge. In mmy օpinion your great creating abilities ѕhould always bbe yoսr priority -
The movie ought to be supplementary.

my աebsite: electronic cigarette Flavors

Anonymous said...

Wonderful article! We will be linking to this great article oon our site.

Keep up the god writing.

Take a look at my blog :: top rated long beach search engine optimization firms

Anonymous said...

Apreciate the recommendation. Let me try
it out.

Here is my blog post: venapro hemorrhoids treatment reviews

Anonymous said...

What's up, after reading this awesome post i am too happy to share
my know-how here with friends.

my web-site: BLack Diamond Reviews

Anonymous said...

In otherpeople's ezines And not only that, it is imperfect.
And my wife and children to be near a cigarette think nothing of burning wood ethanol fireplace traxxas top fuel gallon fires,
and the whole village could read it. Take ethanol fireplace traxxas top fuel
gallon the mixture and wrap it around your
hands and keep it protected. The type of stone has a great decorative advantage.
When the style, period and material you use and the size of the fireplace.
True value exists for them, so go out and buy yourself a fireplace.


Feel free to visit my web site :: http://En.Wikipilipinas.org/index.php/Une_vue_d_ensemble_essentielle_d_%C3%83_l%C3%83_ments_critiques_dans_l_%C3%83_thanol_comment_construire_une_chemin%C3%83_e_entourer

Unknown said...



Finally I've found something which helped me. Thank you
https://3kary.com/property-status/villas-for-rent/
https://3kary.com/property-status/villas-for-rent/
https://3kary.com/property-status/villas-for-sale/
https://3kary.com/property-type/villas/



خدمات منزليه said...

نحن قد علمنا بالمشاكل التي تواجهكم بالمنزل قد عملنا بجد لكي نحل كل هذه المشاكل وبحثنا كثيرا لايجاد كافه الطرق التي تعمل بفعاليه اكثر
شركه رش مبيدات بالطائف
شركه مكافحة حشرات بالطائف
شركه نقل اثاث وعفش بالطائف
شركه تنظيف بالطائف
شركه كشف تسربات المياه بالطائف
شركه تنظيف خزانات بالطائف
شركتنا تتميز بان لديها ضمان للخدمه عام كامل وهذا لاننا واثقون من اننا قد اتقنا في ادائها

Unknown said...

شركة المثالية لمكافحة الحشرات بالخبر

yanmaneee said...

converse shoes
converse shoes
off white shoes
louboutin shoes
louboutin
mbt shoes
balenciaga
balenciaga shoes
moncler jackets
russell westbrook shoes

Anonymous said...

off white
supreme new york
goyard bag
Travis Scott Jordan
air jordan