0
我面臨的問題是,當屏幕方向從potrait更改爲風景時,應用程序崩潰,特別是顯示下拉列表時。我寫了多個代碼來處理這個使用onRestoreInstanceState()等請告訴我,如果我失去了一些東西。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