Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is difference between getEditableText and getText?

I found this question while working with autoCompleteTextView in android.

It seems like it does not allow the autoCompleteTextView to fetch data through getEditableText method as the data is selected by autoCompleteList .

What i understand is that when user edit the data by using inputType (using android keyboard) than that changes are saved somewhere through editable interface but when we select the data through autocomplete list it does not consider it as editable data.

How to find that which method to use with which component.Or i can use any of these two method with any of editable and nonEditable component.Do these methods work same for all of the components or have any differences.

I am asking for conceptual clarification.It will be best if you provide some example.

thank you for your time in advance.

like image 912
kaushal trivedi Avatar asked Mar 18 '13 12:03

kaushal trivedi


2 Answers

getEditableText()

Return the text that TextView is displaying as an Editable object. If the text is not editable, null is returned.

getText()

Return the text that TextView is displaying.

like image 118
IntelliJ Amiya Avatar answered Sep 19 '22 20:09

IntelliJ Amiya


Edit Text:- EditText is a thin veneer over TextView that configures itself to be editable. For more info:- http://developer.android.com/reference/android/widget/EditText.html

Editable Text:- This is the interface for text whose content and markup can be changed (as opposed to immutable text like Strings). If you make a DynamicLayout of an Editable, the layout will be reflowed as the text is changed. for more info:- http://developer.android.com/reference/android/text/Editable.html

It will Solve your confusion .

like image 41
Rahul Rawat Avatar answered Sep 20 '22 20:09

Rahul Rawat