奥林巴斯生物显微镜,艾滋病毒能活多久,破茧成仙
本文实例讲述了android使用vcard文件的方法。分享给大家供大家参考,具体如下:
fileoutputstream os = null; try { os = vcardtest.this.openfileoutput("android.vcf", mode_private); } catch (filenotfoundexception e1) { // todo auto-generated catch block e1.printstacktrace(); } outputstreamwriter writer; try { writer = new outputstreamwriter(os); vcardcomposer composer = new vcardcomposer(); //create a contact contactstruct contact1 = new contactstruct(); contact1.name = "neo"; contact1.company = "the company"; contact1.addphone(contacts.phones.type_mobile, "+123456789", null, true); //create vcard representation string vcardstring; vcardstring = composer.createvcard(contact1, vcardcomposer.version_vcard30_int); //write vcard to the output stream writer.write(vcardstring); writer.write("/n"); //add empty lines between contacts // repeat for other contacts // ... writer.close(); } catch (unsupportedencodingexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (filenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (vcardexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); }
更多关于android相关内容感兴趣的读者可查看本站专题:《android文件操作技巧汇总》、《android数据库操作技巧总结》、《android编程之activity操作技巧总结》、《android编程开发之sd卡操作方法汇总》、《android开发入门与进阶教程》、《android资源操作技巧汇总》、《android视图view技巧总结》及《android控件用法总结》
希望本文所述对大家android程序设计有所帮助。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android studio开发小型对话机器人app(实例代码)
Android通过Java sdk的方式接入OpenCv的方法
Android 通过cmake的方式接入opencv的方法步骤
Android Studio finish()方法的使用与解决app点击“返回”(直接退出)
Android 进度条 ProgressBar的实现代码(隐藏、出现、加载进度)
网友评论