我正在嘗試將vcard(版本3.0)自動導入到android通訊錄中。 在聯繫人管理器中,可以選擇將存儲在SD卡上的vcf文件導入聯繫人。如何通過移交文件來觸發此功能?將vcard 3.0自動導入到android通訊錄(Android 2.1)
2
A
回答
3
我用於我的項目之一下面的解決方案。它工作完美。作爲vCard lib,我使用了cardme v.0.26,它也支持vcard版本3.0。
注意:文件名存儲在res /價值/ strings.xml中......
/*
* Create file. This file has to be readable, otherwise the contact
* application cannot access the file via URI to read the vcard
* string.
*/
//這個變種包含您的名片作爲一個字符串 字符串vcardString;
FileOutputStream fOut = openFileOutput(
getResources().getText(R.string.app_vcard_file_name)
.toString(), MODE_WORLD_READABLE);
osw = new OutputStreamWriter(fOut);
// write vcard string to file
osw.write(vcardString);
// ensures that all buffered bytes are written
osw.flush();
} catch (NotFoundException e) {
// ..
} catch (IOException e) {
// ...
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
// ...
}
}
}
// let the os handle the import of the vcard to the Contacts
// application
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse("file://"
+ getFileStreamPath(
getResources().getText(R.string.app_vcard_file_name)
.toString()).getAbsolutePath()), "text/x-vcard");
startActivity(i);
0
使用聯繫人VCF應用程序從sd卡/手機存儲導入聯繫人到Android手機中的聯繫人。
這裏是鏈接下載應用ContactsVcf
相關問題
- 1. 安卓通訊錄導入
- 2. 通過代碼在導入Android的vCard
- 3. 通訊錄與Android應用
- 4. 檢索Android通訊錄
- 5. Android通訊錄白名單
- 6. Android通訊錄表格
- 7. 掛接到android通訊錄菜單
- 8. Android-Azure-Android通訊
- 9. Vpim :: Vcard - 解析vcard 2.1
- 10. 如何將URL添加到vCard 2.1?
- 11. 將csv文件轉換爲vcard 2.1和3.0的工具
- 12. 如何使用cardme將vCard 3.0轉換爲2.1
- 13. Android通訊
- 14. Android USB通訊
- 15. Android:自動化SVG導入
- 16. 將vCard 3.0轉換爲URL
- 17. FTDI d2xx android通訊
- 18. VCF Vcard導入c#
- 19. vCard導入/導出?
- 20. Android通訊錄查詢多項
- 21. android和ios通訊
- 22. 雲通訊和Android
- 23. Android如何取雅虎通訊錄
- 24. 如何更新Android通訊錄
- 25. Android通訊錄無法檢索數據
- 26. 代碼從通訊錄中的Android
- 27. Android 2.1:我的帳戶身份驗證器導致手機通訊簿崩潰
- 28. 通訊錄與自動引用計數
- 29. 通知Android 3.0
- 30. Android自定義字段沒有顯示在通訊錄中