Thanks Sreehari. Hi Sreehari, Actually that piece of code doesnt work for SDK 1.0 as well.
I sorted out the issue. I had to simply follow the steps explained here : http://developer.android.com/guide/topics/providers/content-providers.html My bad. I didnt read the doc thoroughly before posting this query. Thanks, Kowshik On Tue, Jan 12, 2010 at 11:05 AM, SREEHARI <[email protected] > wrote: > Hi, > I think ur code will work for SDK 1.0 only. For higher version it will > work by applying some small changes in your code. > > Use > > Contacts.People.createPersonInMyContactsGroup(getContentResolver(), > values); > > Instead of > > ContentResolver contRes= getContentResolver(); > contRes.insert(People.CONTENT_URI, values); > > Hope this will work. > > Thanks, > SREEHARI > > > > > > > On Jan 11, 11:32 pm, Kowsh <[email protected]> wrote: > > 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]<android-beginners%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > >
-- 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

