Пример #1
0
 @Override
 public void onBackPressed() {
   chatFragment.onBackPressed();
   if (EasyUtils.isSingleActivity(this)) {
     Intent intent = new Intent(this, MainActivity.class);
     startActivity(intent);
   }
 }
Пример #2
0
 @Override
 protected void onCreate(Bundle arg0) {
   super.onCreate(arg0);
   setContentView(R.layout.em_activity_chat);
   activityInstance = this;
   // 聊天人或群id
   toChatUsername = getIntent().getExtras().getString("userId");
   // 可以直接new EaseChatFratFragment使用
   chatFragment = new ChatFragment();
   // 传入参数
   chatFragment.setArguments(getIntent().getExtras());
   getSupportFragmentManager().beginTransaction().add(R.id.container, chatFragment).commit();
 }