So what I am trying to do is display my database in another activity and add an onItemClickListener. Then I am sending my info by using a URI to another class. I am retrieving the uri in the recipient class and using it to create a Cursor. When I try to initialize my Cursor using getContentResolver().query(), I am getting a nullpointerexception within my log. The line of code looks like this:
Cursor cursor = getContentResolver().query(uri, null, null, null, null);
The uri variable I am using comes from this line of code:
Uri uri = getIntent().getData();
To make sure that some sort of uri is being returned, I output the uri in my log and got this: content://com.example.myfirstapp.ContactProvider/CONTACT/(The id of the item selected)
Here is my log:
01-06 21:31:43.913: E/AndroidRuntime(619): Caused by: java.lang.NullPointerException
01-06 21:31:43.913: E/AndroidRuntime(619): at com.example.myfirstapp.ContactActivity.onCreate(ContactActivity.java:22)
The code at line 22:
Cursor cursor = getContentResolver().query(uri, null, null, null, null);