/**
  * 获取用户VCard信息
  *
  * @param friendname
  * @return
  */
 private VCard getfriendVCard(String friendName) {
   /*if(!NetUtils.isNetConnected()){
   	Log.i(TAG, "Internet error,can't connected to server..");
   	return null;
   }*/
   if (!ASmackManager.getInstance().getXMPPConnection().isConnected()) return null; // 没有连接上
   VCard vCard = new VCard();
   try {
     Timber.d("friendName:" + friendName);
     vCard.load(ASmackManager.getInstance().getXMPPConnection(), friendName);
   } catch (XMPPException e) {
     e.printStackTrace();
   }
   return vCard;
 }
示例#2
0
  /** 获取用户头像信息 */
  public Bitmap getUserImage(String user) {
    Bitmap bitmap = null;
    try {
      VCard vcard = new VCard();
      vcard.load(connection, user);

      if (vcard == null || vcard.getAvatar() == null) {
        return null;
      }
      bitmap = BitmapFactory.decodeByteArray(vcard.getAvatar(), 0, vcard.getAvatar().length);

    } catch (Exception e) {
      e.printStackTrace();
    }
    return bitmap;
  }
示例#3
0
文件: loading.java 项目: kabage/Writr
  public Bitmap gettingCard(XMPPConnection connection) {
    VCard vcard = new VCard();
    try {

      // String x = connection.toString();
      // XMPPConnection connector = new XMPPConnection(x);

      vcard.load(connection, "*****@*****.**");
      Log.i("card loaded", vcard.getJabberId());

      bitmap = BitmapFactory.decodeByteArray(vcard.getAvatar(), 0, vcard.getAvatar().length);
      Log.i("image sizes", String.valueOf(bitmap.getDensity()));

    } catch (XMPPException e) {
      Log.e("error loading the card", e.toString());
    }
    return bitmap;
  }
示例#4
0
  public static VCard getUserVCard(XMPPConnection connection, String user) throws XMPPException {
    VCard vcard = new VCard();
    vcard.load(connection, user);

    return vcard;
  }