Code example for SQLiteOpenHelper

Methods: closegetWritableDatabase

0
		l = MainService.currentBestLocation;
		if (l == null) {
			return; 
		} 
		dbHelper = new DatabaseHelper(MainService.this);
		db = dbHelper.getWritableDatabase();
		 
		cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"), Locale.US);
		cal.setTimeInMillis( l.getTime() );
		 
		data = new ContentValues();
		data.put("day", DateFormat.format("yyyyMMdd", cal).toString() );
		data.put("hour", DateFormat.format("hh", cal).toString() );
		data.put("milliseconds", l.getTime());
		data.put("longitude", l.getLongitude());
		data.put("latitude", l.getLatitude());
		data.put("altitude", l.getAltitude());
		data.put("gpsStart", lGPSTimestamp);
		data.put("accuracy", l.getAccuracy());
		data.put("bearing", l.getBearing());
		data.put("speed", l.getSpeed());
		data.put("provider", l.getProvider());
		db.insert("locations", null, data);
		db.close();
		dbHelper.close();
	} 
 
	@Override 
	public void onStatusChanged(String provider, int status, Bundle extras) {
		Debug(String.format("onStatusChanged: %s status: %d", provider, status));
Connect your IDE to all the code out there  Get Codota for Java