Ok, sorry, in the first case I have wrotten....I don't get an error:
ContentValues values = new ContentValues();
values.put(People.NAME, etname.toString());
Uri uri = getContentResolver().insert(People.CONTENT_URI,
values);
Uri numberUri = Uri.withAppendedPath(uri,
People.Phones.CONTENT_DIRECTORY);
values.clear();
values.put(People.NUMBER, etphonenumber.toString());
getContentResolver().insert(numberUri, values);
But after that, I don't see the contact on the mobile...
I'm using Eclipse SDK on Windows 7 and the version of the SDK is 1.5.
All of this is being tested in a HTC Hero.
On 17 feb, 19:21, Dmitri Plotnikov <[email protected]> wrote:
> Please make sure that whenever you post a question regarding a force close,
> you copy/paste the exception stack trace into the post and also mention what
> environment you are using, what version of the SDK, what device.
>
>
>
> On Wed, Feb 17, 2010 at 11:15 AM, LeGeNDuS <[email protected]> wrote:
> > Thanks...I have added this permission:
>
> > <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
>
> > And now..it doens't stop, but I don't see the contact anywhere...
> > here's the code:
>
> > this one:
>
> > ContentValues values = new ContentValues();
> > values.put(People.NAME, etname.toString());
> > Uri uri = getContentResolver().insert(People.CONTENT_URI,
> > values);
> > Uri numberUri = Uri.withAppendedPath(uri,
> > People.Phones.CONTENT_DIRECTORY);
> > values.clear();
> > values.put(People.NUMBER, etphonenumber.toString());
> > getContentResolver().insert(numberUri, values);
>
> > other one, but this stops:
>
> > ContentValues values = new ContentValues();
> > values.put(People.NAME, etname.toString());
> > values.put(People.PRIMARY_EMAIL_ID, etemail.toString());
> > values.put(People.NUMBER, etphonenumber.toString());
> > Uri uri = getContentResolver().insert(People.CONTENT_URI,
> > values);
>
> > On 17 feb, 16:59, Dmitri Plotnikov <[email protected]> wrote:
> > > Does your app request permission to write to contacts?
>
> > > On Feb 17, 2010 4:11 AM, "LeGeNDuS" <[email protected]> wrote:
>
> > > Hello, I'm trying this code and it's getting stopped in the
> > > getContentResolver statement....
>
> > > ContentValues values = new ContentValues();
> > > values.put(People.NAME, "hola");
> > > Uri uri = getContentResolver().insert(People.CONTENT_URI,
> > > values);
>
> > > What am I doing bad?
>
> > > Thanks!
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%2Bunsubs
> > > [email protected]><android-developers%2Bunsubs
> > [email protected]>
> > > For more options, visit this group athttp://
> > groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%2Bunsubs
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en