What is (s / g) etFreezesText in a TextView?

Recently (perhaps as a new SDK function), when I try to output text from Textview , first I get the getFreezesText() method 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) 

That doesn't tell me anything.

When should we use these methods (if ever)? Are they new or have I just noticed them?

+8
android textview
source share
1 answer

If you want to force your TextView (or EditText , etc.) to save its state, you should add freezesText :

 <TextView ... android:freezesText="true" /> 

From the freezesText documentation:

If set, the text view will include its current full text inside its frozen icicle in addition to metadata such as the current cursor position. By default, this is disabled; this can be useful when the content of the text view is not stored in a permanent place, such as a content provider

Attribute and method exist with API 1, so I will say that you just noticed it.

+8
source share

All Articles