Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Retrieve Text from Textbox in Android widget?

I'm at the very early stage of learning Android. Can anyone tell me how I can use the text written in a Text box by user?

I'm trying to use getText() method but finding it confusing.

Thanks in advance.

like image 706
Pow Avatar asked Aug 31 '10 06:08

Pow


2 Answers

getText should do it.

you maybe need a string cast?

what is the code you using @ the moment?

example:

EditText editText = (EditText)findViewById(R.id.yourId);

String editTextStr = editText.getText().toString()

docs:

http://developer.android.com/reference/android/widget/TextView.html#getText(

like image 188
Michel Avatar answered Sep 16 '22 15:09

Michel


TextBox t = (TextBox)findViewById(R.id.textboxid)
String s = "";
s = t.getText().toString();

Here you can get content of textbox

like image 38
Banshi Avatar answered Sep 16 '22 15:09

Banshi