android - Removing space from Edit Text String -


in android app, getting string edit text , using parameter call web service , fetch json data. now, method use getting string value edit text :

final edittext edittext = (edittext) findviewbyid(r.id.search);  string k = edittext.gettext().tostring(); 

now works fine, if text in edit text contains space app crashes.

for eg. - if types "food" in edit text box, it's ok if types "indian food" crashes.

how remove spaces , string ?

isn't java?

string k = edittext.gettext().tostring().replace(' ', ''); 

Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -