Skip to content

modify onRestoreInstanceState NullPointerException#392

Open
po1arbear wants to merge 1 commit intoH07000223:masterfrom
po1arbear:master
Open

modify onRestoreInstanceState NullPointerException#392
po1arbear wants to merge 1 commit intoH07000223:masterfrom
po1arbear:master

Conversation

@po1arbear
Copy link
Copy Markdown

@po1arbear po1arbear commented Jan 7, 2019

modify NullPointerException in SlidingTabLayout at line 343 "getWidth()"
see #333 #384

@shaco1992
Copy link
Copy Markdown

可惜作者不活跃了

@zhaozhenqiang
Copy link
Copy Markdown

继承父类 @OverRide
protected void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
int position = bundle.getInt("mCurrentTab");
mLogger.info("tag_count", "" + this.getTabCount() + "position:" + position);
if (position >= this.getTabCount()) {
mLogger.info("position > tag_count", "重置current为0");
bundle.putInt("mCurrentTab", 0);
}
}
super.onRestoreInstanceState(state);
mLogger.info("tag_count", "" + this.getTabCount());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants