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

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -