• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EaseMobException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.easemob.exceptions.EaseMobException的典型用法代码示例。如果您正苦于以下问题:Java EaseMobException类的具体用法?Java EaseMobException怎么用?Java EaseMobException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EaseMobException类属于com.easemob.exceptions包,在下文中一共展示了EaseMobException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onBubbleClick

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
    String filePath = fileMessageBody.getLocalUrl();
    File file = new File(filePath);
    if (file != null && file.exists()) {
        // 文件存在,直接打开
        FileUtils.openFile(file, (Activity) context);
    } else {
        // 下载
        context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody()));
    }
    if (message.direct == EMMessage.Direct.RECEIVE && !message.isAcked) {
        try {
            EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId());
            message.isAcked = true;
        } catch (EaseMobException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
}
 
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:23,代码来源:EaseChatRowFile.java


示例2: handleMessage

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
public void handleMessage(Message msg) {
    int what = msg.what;
    switch (what) {
        case ADD_FRIEND:
            String userid = list.get(msg.arg1).getServno();
            if(userid.equals(App.getInstance().getgUserInfo().getServno())){
                CommonUtil.showToast("不能添加自己为好友");
                return ;
            }
            try {
                EMContactManager.getInstance().addContact(list.get(msg.arg1).getServno(), "");
                CommonUtil.showToast("添加好友请求已发送");
            } catch (EaseMobException e) {
                e.printStackTrace();
            }
            break;
        default:
            break;
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:21,代码来源:AddFriendListHeadersAdapter.java


示例3: handleMessage

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
public void handleMessage(Message msg) {
    dialogDismiss();
    switch (msg.what) {
        case OTHER_DATA:
            loadOtherData((CommonResponse) msg.obj);
            break;
        case FOLLOW_OTHER:
            followOtherData((CommonResponse) msg.obj);
            break;
        case ADD_FRIEND:
            try {
                EMContactManager.getInstance().addContact(otherid, "");
                CommonUtil.showToast("添加好友请求已发送");
            } catch (EaseMobException e) {
                e.printStackTrace();
            } break;
        default:
            break;
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:21,代码来源:UserFansDetailsActivity.java


示例4: removeOutBlacklist

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 移出黑民单
 * 
 * @param tobeRemoveUser
 */
void removeOutBlacklist(final String tobeRemoveUser) {
	final String st2 = getResources().getString(R.string.Removed_from_the_failure);
	try {
		// 移出黑民单
	    EMGroupManager.getInstance().unblockUser(groupId, tobeRemoveUser);
		adapter.remove(tobeRemoveUser);
	} catch (EaseMobException e) {
		e.printStackTrace();
		runOnUiThread(new Runnable() {
			public void run() {
				Toast.makeText(getApplicationContext(), st2, 0).show();
			}
		});
	}
}
 
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:21,代码来源:GroupBlacklistActivity.java


示例5: sendACKMessage

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * ACK 消息的发送,根据是否发送成功做些相应的操作,这里是把发送失败的消息id和username保存在序列化类中
 */
private void sendACKMessage() {
    try {
        EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId());
        message.isAcked = true;
    } catch (EaseMobException e) {
        e.printStackTrace();
        EaseACKUtil.getInstance(context).saveACKDataId(message.getMsgId(), message.getFrom());
    } finally {
    	if(message.getBooleanAttribute(EaseConstant.EASE_ATTR_READFIRE, false)
                && message.direct == Direct.RECEIVE){
    		EMChatManager.getInstance().getConversation(message.getFrom()).removeMessage(message.getMsgId());
    		onUpdateView();
    	}
    }
}
 
开发者ID:easemob,项目名称:easeui,代码行数:19,代码来源:EaseChatRowImage.java


示例6: onBubbleClick

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
    String filePath = fileMessageBody.getLocalUrl();
    File file = new File(filePath);
    if (file != null && file.exists()) {
        // 文件存在,直接打开
        FileUtils.openFile(file, (Activity) context);
    } else {
        // 下载
        context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody()));
    }
    if (message.direct == EMMessage.Direct.RECEIVE && !message.isAcked && message.getChatType() == ChatType.Chat) {
        try {
            EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId());
            message.isAcked = true;
        } catch (EaseMobException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
}
 
开发者ID:easemob,项目名称:easeui,代码行数:23,代码来源:EaseChatRowFile.java


示例7: sendACKMessage

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
  * ACK 消息的发送,根据是否发送成功做些相应的操作,这里是把发送失败的消息id和username保存在序列化类中
  */
 private void sendACKMessage() {
     try {
         EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId());
         message.isAcked = true;
     } catch (EaseMobException e) {
         e.printStackTrace();
         // 发送ACK 失败,将ack信息保存在序列化的类中
         EaseACKUtil.getInstance(activity).saveACKDataId(message.getMsgId(), message.getFrom());
     } finally {
     	VoiceMessageBody body = (VoiceMessageBody) message.getBody();
File file = new File(body.getLocalUrl());
      if (file.exists() && file.isFile()) {
          file.delete();
      };
         EMChatManager.getInstance().getConversation(message.getFrom()).removeMessage(message.getMsgId());
if(adapter instanceof EaseMessageAdapter){
          ((EaseMessageAdapter) adapter).refresh();
      }else{
          adapter.notifyDataSetChanged();
      }
     }
 }
 
开发者ID:easemob,项目名称:easeui,代码行数:26,代码来源:EaseChatRowVoicePlayClickListener.java


示例8: removeOutBlacklist

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 移出黑民单
 *
 * @param tobeRemoveUser
 */
void removeOutBlacklist(final String tobeRemoveUser) {
    final String st2 = getResources().getString(R.string.Removed_from_the_failure);
    try {
        // 移出黑民单
        EMGroupManager.getInstance().unblockUser(groupId, tobeRemoveUser);
        adapter.remove(tobeRemoveUser);
    } catch (EaseMobException e) {
        e.printStackTrace();
        runOnUiThread(new Runnable() {
            public void run() {
                Toast.makeText(getApplicationContext(), st2, 0).show();
            }
        });
    }
}
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:21,代码来源:GroupBlacklistActivity.java


示例9: onBubbleClick

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
    String filePath = fileMessageBody.getLocalUrl();
    File file = new File(filePath);
    if (file != null && file.exists()) {
        // 文件存在,直接打开
        FileUtils.openFile(file, (Activity) context);
    } else {
        // 下载
        context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody()));
    }
    if (message.direct == EMMessage.Direct.RECEIVE && !message.isAcked) {
        try {
            EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId());
            message.isAcked = true;
        } catch (EaseMobException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
 
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:23,代码来源:EaseChatRowFile.java


示例10: addUserToBlacklist

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 加入到黑名单
 * 
 * @param username
 */
private void addUserToBlacklist(String username) {
	try {
		EMContactManager.getInstance().addUserToBlackList(username, true);
		Toast.makeText(getApplicationContext(), "移入黑名单成功", 0).show();
	} catch (EaseMobException e) {
		e.printStackTrace();
		Toast.makeText(getApplicationContext(), "移入黑名单失败", 0).show();
	}
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:15,代码来源:ChatActivity.java


示例11: moveToBlacklist

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 把user移入到黑名单
 */
private void moveToBlacklist(final String username){
	final ProgressDialog pd = new ProgressDialog(getActivity());
	pd.setMessage("正在移入黑名单...");
	pd.setCanceledOnTouchOutside(false);
	pd.show();
	new Thread(new Runnable() {
		public void run() {
			try {
				//加入到黑名单
				EMContactManager.getInstance().addUserToBlackList(username,true);
				getActivity().runOnUiThread(new Runnable() {
					public void run() {
						pd.dismiss();
						Toast.makeText(getActivity(), "移入黑名单成功", 0).show();
					}
				});
			} catch (EaseMobException e) {
				e.printStackTrace();
				getActivity().runOnUiThread(new Runnable() {
					public void run() {
						pd.dismiss();
						Toast.makeText(getActivity(), "移入黑名单失败", 0).show();
					}
				});
			}
		}
	}).start();
	
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:33,代码来源:ContactlistFragment.java


示例12: addToGroup

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
public void addToGroup(View view){
	final ProgressDialog pd = new ProgressDialog(this);
	pd.setMessage("正在发送请求...");
	pd.setCanceledOnTouchOutside(false);
	pd.show();
	new Thread(new Runnable() {
		public void run() {
			try {
				//如果是membersOnly的群,需要申请加入,不能直接join
				if(group.isMembersOnly()){
					EMGroupManager.getInstance().applyJoinToGroup(groupid, "求加入");
				}else{
					EMGroupManager.getInstance().joinGroup(groupid);
				}
				runOnUiThread(new Runnable() {
					public void run() {
						pd.dismiss();
						Toast.makeText(GroupSimpleDetailActivity.this, "加入群聊成功", 0).show();
						btn_add_group.setEnabled(false);
					}
				});
			} catch (final EaseMobException e) {
				e.printStackTrace();
				runOnUiThread(new Runnable() {
					public void run() {
						pd.dismiss();
						Toast.makeText(GroupSimpleDetailActivity.this, "加入群聊失败:"+e.getMessage(), 0).show();
					}
				});
			}
		}
	}).start();
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:34,代码来源:GroupSimpleDetailActivity.java


示例13: removeOutBlacklist

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 移出黑民单
 * 
 * @param tobeRemoveUser
 */
void removeOutBlacklist(final String tobeRemoveUser) {
	try {
		// 移出黑民单
		EMContactManager.getInstance().deleteUserFromBlackList(tobeRemoveUser);
		adapter.remove(tobeRemoveUser);
	} catch (EaseMobException e) {
		e.printStackTrace();
		runOnUiThread(new Runnable() {
			public void run() {
				Toast.makeText(getApplicationContext(), "移出失败", 0).show();
			}
		});
	}
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:20,代码来源:BlacklistActivity.java


示例14: moveToBlacklist

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 把user移入到黑名单
 */
protected void moveToBlacklist(final String username){
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st1 = getResources().getString(R.string.Is_moved_into_blacklist);
    final String st2 = getResources().getString(R.string.Move_into_blacklist_success);
    final String st3 = getResources().getString(R.string.Move_into_blacklist_failure);
    pd.setMessage(st1);
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                //加入到黑名单
                EMContactManager.getInstance().addUserToBlackList(username,false);
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), st2, 0).show();
                        refresh();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), st3, 0).show();
                    }
                });
            }
        }
    }).start();
    
}
 
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:37,代码来源:EaseContactListFragment.java


示例15: asyncFetchContactsFromServer

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
public void asyncFetchContactsFromServer() {
    if (isSyncingContactsWithServer) {
        return;
    }

    isSyncingContactsWithServer = true;

    new Thread() {
        @Override
        public void run() {
            List<String> usernames = null;
            try {
                usernames = EMContactManager.getInstance().getContactUserNames();
                // in case that logout already before server returns, we should return immediately
                if (!EMChat.getInstance().isLoggedIn()) {
                    return;
                }
                isSyncingContact = true;
                isSyncingContactsWithServer = false;
                EventBus.getDefault().post(new ContactsListEventType(usernames));
            } catch (EaseMobException e) {
                isSyncingContact = false;
                isSyncingContactsWithServer = false;
                e.printStackTrace();
            }

        }
    }.start();
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:30,代码来源:HXChatManagerInit.java


示例16: asyncFetchGroupsFromServer

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 同步操作,从服务器获取群组列表
 *
 * @throws EaseMobException
 */
public synchronized void asyncFetchGroupsFromServer() {
    if (isSyncingGroupsWithServer) {
        return;
    }

    isSyncingGroupsWithServer = true;

    new Thread() {
        @Override
        public void run() {
            List<EMGroup> groups;
            try {
                groups = EMGroupManager.getInstance().getGroupsFromServer();

                // in case that logout already before server returns, we should return immediately
                if (!EMChat.getInstance().isLoggedIn()) {
                    return;
                }
                isSyncingGroups = true;
                isSyncingGroupsWithServer = false;
                saveGroupList(groups);
            } catch (EaseMobException e) {
                isSyncingGroups = false;
                isSyncingGroupsWithServer = false;
            }

        }
    }.start();
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:35,代码来源:HXChatManagerInit.java


示例17: asyncFetchUserFromServer

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
/**
 * 同步操作,从服务器获取好友列表
 *
 * @throws EaseMobException
 */
public synchronized void asyncFetchUserFromServer() {
    if (isSyncingUserWithServer) {
        return;
    }

    isSyncingUserWithServer = true;

    new Thread() {
        @Override
        public void run() {
            List<String> usernames;
            try {

                usernames = EMContactManager.getInstance().getContactUserNames();

                // in case that logout already before server returns, we should return immediately
                if (!EMChat.getInstance().isLoggedIn()) {
                    return;
                }

                isSyncingUsers = true;
                isSyncingUserWithServer = false;

                saveUserList(usernames);

            } catch (EaseMobException e) {
                isSyncingUsers = false;
                isSyncingUserWithServer = false;
            }

        }
    }.start();
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:39,代码来源:HXChatManagerInit.java


示例18: getView

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.item_mayknow, parent, false);
        holder = new ViewHolder();
        holder.head = (SelectableRoundedImageView) convertView.findViewById(R.id.head);
        holder.name_tv = (TextView) convertView.findViewById(R.id.name_tv);
        holder.add_tv = (TextView) convertView.findViewById(R.id.add_tv);
        holder.add_tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                try {
                    EMContactManager.getInstance().addContact(list.get(position).getServno(), "");
                    CommonUtil.showToast("添加好友请求已发送");
                } catch (EaseMobException e) {

                }
            }
        });
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    ImageLoader.getInstance().displayImage(list.get(position).getUphoto(), holder.head);
    holder.name_tv.setText(list.get(position).getUalias());
    return convertView;
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:29,代码来源:MayKnowAdapter.java


示例19: asyncGetRobotNamesFromServer

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
private void asyncGetRobotNamesFromServer(final EMValueCallBack<List<EMContact>> callback) {
	new Thread(new Runnable() {

		@Override
		public void run() {
			try {
				List<EMContact> mList = EMChatManager.getInstance().getRobotsFromServer();
				callback.onSuccess(mList);
			} catch (EaseMobException e) {
				e.printStackTrace();
				callback.onError(e.getErrorCode(), e.toString());
			}
		}
	}).start();
}
 
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:16,代码来源:RobotsActivity.java


示例20: addUserToBlackList

import com.easemob.exceptions.EaseMobException; //导入依赖的package包/类
protected void addUserToBlackList(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setCanceledOnTouchOutside(false);
    pd.setMessage(getString(R.string.Are_moving_to_blacklist));
    pd.show();
    new Thread(new Runnable() {
    	public void run() {
    		try {
    		    EMGroupManager.getInstance().blockUser(groupId, username);
    			runOnUiThread(new Runnable() {
    				public void run() {
    				    refreshMembers();
    				    pd.dismiss();
    					Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, 0).show();
    				}
    			});
    		} catch (EaseMobException e) {
    			runOnUiThread(new Runnable() {
    				public void run() {
    				    pd.dismiss();
    					Toast.makeText(getApplicationContext(), R.string.failed_to_move_into, 0).show();
    				}
    			});
    		}
    	}
    }).start();
}
 
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:28,代码来源:GroupDetailsActivity.java



注:本文中的com.easemob.exceptions.EaseMobException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Telephone类代码示例发布时间:2022-05-23
下一篇:
Java Criterion类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap