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

haskell - Using filter on an item in a list? -

c# - When does PreApplicationStartMethod actually get triggered to run? -

tomcat6 - Exception when stopping container for a with Spring + Quartz + Tomcat web application -