Android使用vcard文件的方法簡單實(shí)例
本文實(shí)例講述了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();
}
更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android文件操作技巧匯總》、《Android數(shù)據(jù)庫操作技巧總結(jié)》、《Android編程之a(chǎn)ctivity操作技巧總結(jié)》、《Android編程開發(fā)之SD卡操作方法匯總》、《Android開發(fā)入門與進(jìn)階教程》、《Android資源操作技巧匯總》、《Android視圖View技巧總結(jié)》及《Android控件用法總結(jié)》
希望本文所述對大家Android程序設(shè)計有所幫助。
- android按行讀取文件內(nèi)容的幾個方法
- Android中asset文件夾與raw文件夾的區(qū)別深入解析
- Android 文件選擇的實(shí)現(xiàn)代碼
- Android學(xué)習(xí)筆記-保存文件(Saving Files)
- Android通過LIstView顯示文件列表的兩種方法介紹
- Android 讀取Properties配置文件的小例子
- Android zip文件下載和解壓實(shí)例
- Android中通過MediaStore獲取音樂文件信息方法
- 通過Android trace文件分析死鎖ANR實(shí)例過程
- Android獲取assets文件夾中的數(shù)據(jù)并寫入SD卡示例
- Android 原始資源文件的使用詳解
相關(guān)文章
Android入門之PopupWindow用法實(shí)例解析
這篇文章主要介紹了Android入門之PopupWindow用法,對于Android初學(xué)者來說有一定的學(xué)習(xí)借鑒價值,需要的朋友可以參考下2014-08-08
Android啟動頁用戶相關(guān)政策彈框的實(shí)現(xiàn)代碼
這篇文章主要介紹了Android啟動頁用戶相關(guān)政策彈框的實(shí)現(xiàn)方法,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-05-05
Flutter 實(shí)現(xiàn)網(wǎng)易云音樂字幕的代碼
這篇文章主要介紹了Flutter 實(shí)現(xiàn)網(wǎng)易云音樂字幕的代碼,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-04-04
android TextView 設(shè)置和取消刪除線的兩種方法
這篇文章主要介紹了android TextView 設(shè)置和取消刪除線的兩種方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-03-03
Android Activity Results API代替onActivityResul
說到onActivityResult,我們已經(jīng)非常熟悉來,通過在A activity啟動B activity并且傳入數(shù)據(jù)到B中,然后在A中通過onActivityResult來接收B中返回的數(shù)據(jù)。在最新的activity-ktx的beta版本中,谷歌已經(jīng)廢棄了onActivityResult2022-09-09
Android自定義實(shí)現(xiàn)側(cè)滑菜單效果
這篇文章主要為大家詳細(xì)介紹了Android自定義實(shí)現(xiàn)側(cè)滑菜單效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-01-01
Android 給圖片加上水印的示例代碼(支持logo+文字)
本篇文章主要介紹了Android 給圖片加上水印的示例代碼(支持logo+文字),具有一定的參考價值,有興趣的可以了解一下2017-08-08
大型項(xiàng)目里Flutter測試應(yīng)用實(shí)例集成測試深度使用詳解
這篇文章主要為大家介紹了大型項(xiàng)目里Flutter測試應(yīng)用實(shí)例集成測試深度使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-12-12
Android入門之TableLayout應(yīng)用解析(二)
這篇文章主要介紹了Android入門之TableLayout應(yīng)用,需要的朋友可以參考下2014-08-08

