Hi,
I am trying to write a simple app for my G1 phone that runs Android
1.6. The app should be able to access and modify the Contacts list at
runtime.
I configured my android project in eclipse with API level 4 for 1.6. I
set read and write "user permissions" in the android manifest file and
I tried using the following code to commit changes to the Contacts
list in the onCreate(...) method of my Activitiy class :
public class GolfScore extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ContentValues values = new ContentValues();
//Set NAME for new contact
values.put(People.NAME, "John Mogambo");
//Add contact to 'Favourites' list
values.put(People.STARRED, "1");
//Commit changes
ContentResolver contRes= getContentResolver();
contRes.insert(People.CONTENT_URI, values);
}
}
I find that when I minimise my app at runtime in the emulator and open
the contacts app, the new contact : "John Mogambo" has been added to
"Favourites" list alone. It doesnt figure in the main list of
contacts.
I would be grateful if somebody could point out whats missing in my
code.
Thanks,
Kowshik
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en