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 <[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]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to