I am creating an application which tracks the users location using GPS, stores the longitude and latitude in a database using a content provider then output the first long and lat to a mapview.
I am able to create the cursor using this line of code:
Cursor c = getContentResolver().query(GPSContentProvider.CONTENT_URI,
null, null, null, null);
startManagingCursor(c);
However, when I make a call to move to the first row in the database or even try to close the cursor using c.close();
I receive a NullPointerException
.
Edit: Just to make it clear, I can store the longitude, latitude and time in milli's within the database, the problem is then taking the data out of the database and displyaing this on a map.
Updated code:
public static final String AUTHORITY = "application.android.prototype";
// followed by the CONTENT_URI
public static final Uri CONTENT_URI = Uri.
parse("content://" + AUTHORITY + "/gpspoints");
Updated permissions:
<provider android:name="GPSDataContentProvider" android:authorities="application.android.prototype">
</provider>