AutoCompleteTextView处理屏幕方向更改
问题描述:
我面临的问题是,当屏幕方向从potrait更改为风景时,应用程序崩溃,特别是显示下拉列表时。我写了多个代码来处理这个使用onRestoreInstanceState()等请告诉我,如果我失去了一些东西。AutoCompleteTextView处理屏幕方向更改
答
发表一次你的代码..
该特定异常的源代码似乎是一个相当更有帮助的错误信息更新:
protected void onRestoreInstanceState(Parcelable state) {
mPrivateFlags |= SAVE_STATE_CALLED;
if (state != BaseSavedState.EMPTY_STATE && state != null) {
throw new IllegalArgumentException("Wrong state class, expecting View State but "
+ "received " + state.getClass().toString() + " instead. This usually happens "
+ "when two views of different type have the same id in the same hierarchy. "
+ "This view's id is " + ViewDebug.resolveId(mContext, getId()) + ". Make sure "
+ "other views do not use the same id.");
}
}
如果您使用Java代码来创建此布局可能会发生问题。 理想情况下,您将使用XML进行布局。它会让你的生活变得更容易。
希望这会有所帮助..
请添加您的代码。 – Karan 2011-03-24 07:25:09