As of recently (probably as a new SDK feature), when I try to pull text from a Textview
, I first get the method getFreezesText()
, instead of getText()
.
I looked at the definition of this method and it says
**android:freezesText**
If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
This corresponds to the global attribute resource symbol freezesText.
Related Methods
setFreezesText(boolean)
This tells nothing to me.
When we are supposed to use these methods (if ever at all)? Are they new or I've just noticed them?
If you want to force your TextView
(or EditText
etc. for that matter) to save its state you must add freezesText
attribute:
<TextView
...
android:freezesText="true" />
From documentation on freezesText
:
If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider
The attribute and method have existed since API 1, so I'll say you just noticed it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With