Silicon Valley social networking 6 -- add Contacts -- send invitations to add friends, Silicon Valley 6 --
1. Search button Processing
// Go to the server to determine whether the currently searched user has userInfo = new UserInfo (name); // update the UI to display runOnUiThread (new Runnable () {@ Overridepublic void run () {rl_add.setVisibility (View. VISIBLE); TV _add_name.setText (userInfo. getName ());}});
2. Add button Processing
Model.getinstance().getglobalthreadpool(cmd.exe cute (new Runnable () {@ Overridepublic void run () {// Add a friend try {EMClient to the email broker. getInstance (). contactManager (). addContact (userInfo. getName (), "add friend"); runOnUiThread (new Runnable () {@ Overridepublic void run () {Toast. makeText (AddContactActivity. this, "sent the invitation to add friends", Toast. LENGTH_SHORT ). show () ;}) ;}catch (final HyphenateException e) {e. printStackTrace (); runOnUiThread (new Runnable () {@ Overridepublic void run () {Toast. makeText (AddContactActivity. this, "failed to send an invitation to add friends" + e. toString (), Toast. LENGTH_SHORT ). show ();}});}}});