fix:修复首页ViewPager.setCurrentItem(int)为null导致的闪退问题
This commit is contained in:
@@ -259,8 +259,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
});
|
||||
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("2")) {
|
||||
//跳转消息列表
|
||||
mViewPager.setCurrentItem(2);
|
||||
mTabButtonGroup.setCurPosition(2);
|
||||
if (mViewPager != null) {
|
||||
mViewPager.setCurrentItem(2);
|
||||
mTabButtonGroup.setCurPosition(2);
|
||||
}
|
||||
|
||||
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("8")) {
|
||||
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true);
|
||||
@@ -381,8 +383,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
mUrlCsd = configBean.getCustomerServerUrl();
|
||||
init();
|
||||
initTXIM();
|
||||
mViewPager.setCurrentItem(0);
|
||||
mTabButtonGroup.setCurPosition(0);
|
||||
if (mViewPager != null) {
|
||||
mViewPager.setCurrentItem(0);
|
||||
mTabButtonGroup.setCurPosition(0);
|
||||
}
|
||||
isInstructor();
|
||||
|
||||
RongConfigCenter.notificationConfig().setInterceptor(new NotificationConfig.Interceptor() {
|
||||
@@ -1160,7 +1164,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
finish();
|
||||
} else if (event.getPage() == 17) {
|
||||
showStartDialog();
|
||||
} else {
|
||||
} else if (mViewPager != null) {
|
||||
mViewPager.setCurrentItem(event.getPage());
|
||||
mTabButtonGroup.setCurPosition(event.getPage());
|
||||
if (event.getPage() == 0) {
|
||||
@@ -1229,9 +1233,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onInstructorOperationEvent(InstructorOperationEvent event) {
|
||||
//跳转消息列表
|
||||
mViewPager.setCurrentItem(2);
|
||||
mTabButtonGroup.setCurPosition(2);
|
||||
mainMessageViewHolder.setHomeZdyPop(NoviceInstructorManager.get(this).getHomeZdyPop());
|
||||
if (mViewPager != null) {
|
||||
mViewPager.setCurrentItem(2);
|
||||
mTabButtonGroup.setCurPosition(2);
|
||||
mainMessageViewHolder.setHomeZdyPop(NoviceInstructorManager.get(this).getHomeZdyPop());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1262,8 +1268,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//跳转消息列表
|
||||
mViewPager.setCurrentItem(2);
|
||||
mTabButtonGroup.setCurPosition(2);
|
||||
if (mViewPager != null) {
|
||||
mViewPager.setCurrentItem(2);
|
||||
mTabButtonGroup.setCurPosition(2);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user