Ejemplo n.º 1
0
 /**
  * 获取用户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;
 }
Ejemplo n.º 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;
  }
Ejemplo n.º 3
0
  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;
  }
Ejemplo n.º 4
0
  public static VCard getUserVCard(XMPPConnection connection, String user) throws XMPPException {
    VCard vcard = new VCard();
    vcard.load(connection, user);

    return vcard;
  }