Getting Error While getting Added Contacts with content provider
<p>I am getting following error while getting added contact from Contacts Provider.</p>

<pre><code>11-26 18:58:57.060: I/Contacts(3129): msg ::java.lang.NullPointerException
11-26 18:58:57.060: I/Choreographer(3129): Skipped 49 frames!  The application may be         doing too much work on its main thread.
</code></pre>

<p>I have added read contacts and write contacts permissions also.
Following is the code is my Contacts Activity Code ::</p>

<pre><code>package com.smsapp.android;


import java.util.UUID;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.RawContacts.Data;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;


public class Contacts extends Activity implements OnItemClickListener {

private static final String TAG = "Contacts";

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    ContentResolver c = getContentResolver();

setContentView(R.layout.main);
    String name = "First Family";
    String phone = "0123456789";

    ContentValues values = new ContentValues();
    values.put(ContactsContract.Contacts.DISPLAY_NAME, name);
    values.put(Phone.TYPE, Phone.TYPE_OTHER);
    values.put(Phone.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
    values.put(Data.RAW_CONTACT_ID, "13123");
    values.put(Phone.NUMBER, phone);
    c.insert(ContactsContract.Data.CONTENT_URI, values);


try{
    Cursor cursor = getContentResolver().query(ContactsContract.Data.CONTENT_URI, null, null, null, null); 

        if (null == cursor) {
            Log.v(TAG, "null data");
        }else if (cursor.getCount() &lt; 1) {
            Log.v(TAG, "null data");
        } else {
            Log.v(TAG, "data is present");
        }

        SimpleCursorAdapter adapter = new SimpleCursorAdapter(
            getApplicationContext(),
            R.layout.row,
            cursor,
            new String[] {ContactsContract.Contacts.DISPLAY_NAME,Phone.NUMBER},
            new int[] {R.id.text1, R.id.text2}
        );
        ListView listView = (ListView) findViewById(R.id.ListViewId);
        listView.setAdapter(adapter);
        listView.setOnItemClickListener(this);
    }catch (Exception e) {
     Log.i(TAG, "*msg ::"+ e.toString());
    }
 }

@Override
public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id) {

    Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id);
    Intent intent = new Intent(this, ContactDetails.class);
    intent.setData(contactUri);
    startActivity(intent);

}

}
</code></pre>

<p>Please let me know what is wrong in this code.</p>
