注册

添加好友监听没有任何反应,求助!

添加好友监听没反应啊?

/**
* add frd
* @param view
*/
public void findFrd(View view){
if(!TextUtils.isEmpty(et_find.getText().toString().trim())){
try {
EMContactManager.getInstance().addContact(et_find.getText().toString().trim(), "add a friends?");
Toast.makeText(this, "add frd", Toast.LENGTH_SHORT).show();
} catch (EaseMobException e) {
e.printStackTrace();
Toast.makeText(this, "add frd fail", Toast.LENGTH_SHORT).show();
Log.d("mianAct", "add frd fail");
}
}
}




@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_find = (EditText) findViewById(R.id.et_find);
EMContactManager.getInstance().setContactListener(new MyContactLis());
EMChatManager.getInstance().addConnectionListener(new MyConnecLis());
EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeLis());
EMChat.getInstance().setAppInited();//init finish
Toast.makeText(this, "init lis finish", Toast.LENGTH_SHORT).show();
}



private class MyContactLis implements EMContactListener {

@Override
public void onContactAdded(List arg0) {

}

@Override
public void onContactAgreed(String username) {

}

@Override
public void onContactDeleted(List arg0) {

}

@Override
public void onContactInvited(String username, String reason) {
Log.i("contactlis", "get a contact invite from"+username);
Toast.makeText(getApplicationContext(), "get a contact invite from" + username, Toast.LENGTH_SHORT).show();
}

@Override
public void onContactRefused(String username) {

}
}

已邀请:

要回复问题请先登录注册