Re: [android-beginners] Re: Query on committing changes to content providers

2010-01-17 Thread Kowshik Prakasam
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 sreehari.madhusooda...@wipro.com
 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 kows...@gmail.com 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
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Query on committing changes to content providers

2010-01-13 Thread SREEHARI
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 kows...@gmail.com 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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Query on committing changes to content providers

2010-01-11 Thread Kowsh
Here is my manifest file for your reference :

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.golf android:versionCode=1 android:versionName=1.0

application android:icon=@drawable/icon android:label=@string/
app_name
activity android:name=.GolfScore
  android:label=@string/app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity

/application
uses-sdk android:minSdkVersion=4 /

uses-permission android:name=android.permission.READ_CONTACTS/
uses-permission
uses-permission android:name=android.permission.WRITE_CONTACTS/
uses-permission
/manifest

Thanks,
Kowshik

On Jan 11, 11:32 pm, Kowsh kows...@gmail.com 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
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en