예제 #1
0
 @Override
 protected void onNewIntent(Intent intent) {
   // 点击notification bar进入聊天页面,保证只有一个聊天页面
   String username = intent.getStringExtra("userId");
   if (toChatUsername.equals(username)) super.onNewIntent(intent);
   else {
     finish();
     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();
 }
예제 #3
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   activityInstance = null;
 }