修复 脚本文件过大时崩溃的问题

This commit is contained in:
hyb1996
2018-11-20 20:49:30 +08:00
parent ed58797eaa
commit 237dbe0f50
5 changed files with 46 additions and 17 deletions

View File

@@ -0,0 +1,30 @@
package android.widget;
import java.lang.reflect.Field;
public class TextViewHelper {
private static final Field sSavedStateText;
static {
Field text = null;
try {
text = TextView.SavedState.class.getDeclaredField("text");
text.setAccessible(true);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
sSavedStateText = text;
}
public static void setText(TextView.SavedState state, CharSequence text) {
if (sSavedStateText == null) {
return;
}
try {
sSavedStateText.set(state, text);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}