android - How EditText Retains its value but not textview when phone orientation changes? -
It is so special about the editor that it can maintain the value, but Textview and some other widgets are not available To use on saved instances) method for them.
What is the magic behind the editing text that it can maintain values?
If someone can say how it works internally
& lt; ---- Update ---- & gt;
How it works internally, please point to the part of the scenario that describes this scenario.
What is the magic behind editing especially that it can maintain values? How it works internally, please point to that part of the code interpreting this scenario.
This is a selectable asset that changes the difference in the following
if position is to be taken into account.
@override public parcelable onSaveInstanceState () {parcelable superstat = super. Onsite InstantState (); // Save the condition if we are compelled to save the boolean = mFreezesText; Int start = 0; Int end = 0; If (mText! = Null) {start = getSelectionStart (); End = getSelectionEnd (); If (start gt; = 0 || termination = gt; = 0) {// if saves a selection, then = is saved; }} ...}
By default,
TextView can not be selected. Therefore,
getSelectionStart () and
getSelectionEnd () returns
-1 , there is a false value by the variable
save . To keep content on the orientation change, set the attribute to the correct.
Since
EditText is selected by default,
getSelectionStart () and
note: disabled by default
Therefore the
mFreezesText value is incorrect.
Comments
Post a Comment