tags:

views:

36

answers:

1

how can i assign value of EditText to a string? I want to pass this value to an another activity through putExtras().

my code is :

 EditText txtquantity=(EditText) findViewById(R.id.EditText01);

quantity_bundle.putString("quantity",txtquantity.getText());

when I am doing like this an error is occured. Please give me the solution... Thank you...

+1  A: 

The getText() on a EditText object returns the Text as an Editable call toString() to get the actual text.

quantity_bundle.putString("quantity",txtquantity.getText().toString());
madsleejensen
`getText()` returns `CharSequence`, not a `TextView`. This code also may be used: quantity_bundle.putCharSequence("quantity",txtquantity.getText());
Sergey Glotov
thank you so much...
Miya
Accept answer, please, if it solves your problem.
Sergey Glotov
sorry for the delay...
Miya
Thank you so much..., it helped me a lot...
Miya