独角兽企业重金招聘Python工程师标准>>>
获取昵称
VCardvCard=newVCard();vCard.load(Asmackconniciton.connection,number+"@");Log.d("ccc","昵称是"+vCard.getOrganization());//公司Log.d("ccc","昵称是"+vCard.getNickName());
设置昵称
VCardvCard1=newVCard();vCard1.setNickName("我是小伍");vCard1.setOrganization("当前这个人的电话号码当前这个人的电话号码当前这个人的电话号码");vCard1.save(Asmackconniciton.connection);
获取好友头像
finalVCardvcard=newVCard();try{if(tag.equals("my")){vcard.load(Asmackconniciton.connection);}else{vcard.load(Asmackconniciton.connection,user+"@");}}catch(XMPPExceptione1){}if(vcard==null||vcard.getAvatar()==null){Log.i("xxx",vcard+"是空的");return;}try{System.out.println("获取用户头像信息:"+user);ByteArrayInputStreambais=newByteArrayInputStream(vcard.getAvatar());bytebuf[]=newbyte[1024];if(tag.equals("my")){download=newFile(Environment.getExternalStorageDirectory()+"/.IMTONG/Vcard/Head/my.png");}else{download=newFile(Environment.getExternalStorageDirectory()+"/.IMTONG/Vcard/Head/"+filename+".png");}FileOutputStreamfos=newFileOutputStream(download);do{//循环读取intnumread=bais.read(buf);if(numread==-1){break;}fos.write(buf,0,numread);}while(true);bais.close();fos.close();