@Override public void onBackPressed() { long t = System.currentTimeMillis(); if (t - mPrevbackPress <= 1000) { super.onBackPressed(); } else { Toast.makeText(this, "再按一次返回退出", Toast.LENGTH_SHORT).show(); } mPrevbackPress = t; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); cid = getIntent().getData().getQueryParameter("id"); ListView listView = (ListView) findViewById(R.id.listView); adapter = new Adapter(StudentDetailActivity.this); listView.setAdapter(adapter); listView.setOnItemClickListener(this); requestData(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_root); tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); tabHost.addTab( tabHost .newTabSpec("manager") .setIndicator(createTabItem("课程管理", R.drawable.ic_tab_manager)), CourseManagerFragment.class, null); View groupTabItem = createTabItem("学生群组", R.drawable.ic_tab_group); groupDot = groupTabItem.findViewById(R.id.dot); tabHost.addTab( tabHost.newTabSpec("chatlist").setIndicator(groupTabItem), ChatListFragment.class, null); tabHost.addTab( tabHost .newTabSpec("material") .setIndicator(createTabItem("教材教具", R.drawable.ic_tab_material)), TeachMaterialFragment.class, null); View mineTabItem = createTabItem("我的", R.drawable.ic_tab_mine); mineDot = mineTabItem.findViewById(R.id.dot); tabHost.addTab(tabHost.newTabSpec("mine").setIndicator(mineTabItem), MineFragment.class, null); tabHost.setOnTabChangedListener(this); // Umeng MobclickAgent.updateOnlineConfig(this); UmengUpdateAgent.silentUpdate(this); // RongCloud doRCIMConnect(3); isFirstLogin = Boolean.valueOf(getIntent().getData().getQueryParameter("isFirstLogin")); if (isFirstLogin) { startActivity("sgteacher://applyteacher?fromLogin=true"); } RongIM.setOnReceiveMessageListener(this); setSwipeBackEnable(false); }
@Override public void onResume() { super.onResume(); refreshDot(); }