獲取暱稱java
VCard vCard = new VCard(); vCard.load(Asmackconniciton.connection,number+ "@linhuic99.vicp.cc"); Log.d("ccc","暱稱是"+vCard.getOrganization()); //公司 Log.d("ccc","暱稱是"+vCard.getNickName());
設置暱稱web
VCard vCard1 = new VCard(); vCard1.setNickName("我是小伍"); vCard1.setOrganization("當前這我的的電話號碼當前這我的的電話號碼當前這我的的電話號碼"); vCard1.save(Asmackconniciton.connection);
獲取好友頭像ui
final VCard vcard = new VCard(); try { if (tag.equals("my")) { vcard.load(Asmackconniciton.connection);} else { vcard.load(Asmackconniciton.connection, user+ "@linhuic99.vicp.cc");} } catch (XMPPException e1) {} if (vcard == null || vcard.getAvatar() == null) { Log.i("xxx", vcard + "是空的"); return; } try { System.out.println("獲取用戶頭像信息: " + user); ByteArrayInputStream bais = new ByteArrayInputStream( vcard.getAvatar()); byte buf[] = new byte[1024]; if (tag.equals("my")) { download = new File(Environment.getExternalStorageDirectory() + "/.IMTONG/Vcard/Head/my.png"); } else { download = new File(Environment.getExternalStorageDirectory() + "/.IMTONG/Vcard/Head/" + filename + ".png"); } FileOutputStream fos = new FileOutputStream(download); do { // 循環讀取 int numread = bais.read(buf); if (numread == -1) { break; } fos.write(buf, 0, numread); } while (true); bais.close(); fos.close();