0

我正在使用 2.1 平台.......我能够从模拟器中检索所有联系人和 SMS,并将其复制到文本文件中并将其存储在具有特定用户帐户的服务器中。我还必须恢复这些联系人和短信返回到模拟器。我不知道该怎么做。现在我正在使用 AVD 和 Eclipse 运行 Android 项目。我打算购买新的安卓手机并将这些联系人和短信恢复到那个状态mobile.I 使用CURSOR 和 CONTENT_URI检索联系人,使用CURSOR检索 SMS 。

如何从服务器中的文本文件恢复到模拟器?

4

1 回答 1

0

您可以读取文本文件并将数据保存在光标对象中吗?如果是,请点击链接。您将需要使用一些循环来添加每个联系人。

要从光标中获取值,您可以使用链接作为参考。

编辑:这里是第二个链接的代码

ContentValues values = new ContentValues();
values.put(Contacts.People.NAME, "Test Name");
// add it to the database
ContentURI newPerson = getContentResolver().insert(Contacts.People.CONTENT_URI, values);

// assign the new phone number to the person
values.clear();
values.put(Contacts.Phones.PERSON_ID, newPerson.getPathLeaf());
values.put(Contacts.Phones.NUMBER, "(800) 466-4411");
// insert the new phone number in the database
getContentResolver().insert(Contacts.Phones.CONTENT_URI, values);

我将无法解释这一点,因此请尝试访问第一个链接。

于 2012-07-19T07:38:54.257 回答