首页 > 代码库 > android_备份还原通讯录

android_备份还原通讯录

package cn.m15.helper.logic;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
import android.provider.ContactsContract;

public class ContactsSyncer extends Syncer {

	public void backup(Context context) {
		ContentResolver cr = context.getContentResolver();
		Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
				null, null, null);
		int index = cur.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY);
		FileOutputStream fout;
		try {
			fout = new FileOutputStream(
					Environment.getExternalStorageDirectory() + "/go.vcf");
			byte[] data = http://www.mamicode.com/new byte[1024 * 1];>

android_备份还原通讯录