A simple example of how Android uses a vcard file _android

Source: Internet
Author: User
Tags create vcard vcard

The example in this article describes how Android uses a vcard file. Share to everyone for your reference, specific as follows:

FileOutputStream OS = null; try {os = VCardTest.this.openFileOutput ("android.vcf", mode_private);} catch (FileNotFoundException E1) {//TODO Au
To-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 (Filenotfou Ndexception e) {//TODO auto-Generated catch block E.printstacktrace (); catch (Vcardexception e) {//TODO auto-generated catch block e.printstacktrace (); \ catch (IOException e) {/To
Do auto-generated catch block E.printstacktrace ();

 }

For more information on Android-related content readers can view the site: "Android file Operation tips Summary", "Android Database Operating skills summary", "Android programming activity Operation Skills Summary", " Android programming development of the SD card operation method Summary, "Android Development introduction and Advanced Course", "Android Resource Operation skills Summary", "Android View tips Summary" and "Android Control usage Summary"

I hope this article will help you with the Android program.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.