package com.example.test_db;

import java.util.ArrayList;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

// http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/

public class MainActivity extends Activity 
{

	DB_GPS db;
	private SQLiteDatabase dataBase;

	final static ArrayList<GPS> GPS = new ArrayList<GPS>();
	
	static  ArrayList<GPS> objets= new ArrayList<GPS>();  
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		db = new DB_GPS(getApplicationContext());
		
		long now = System.currentTimeMillis();
		GPS infos = new GPS("un", now  ,50.0, 60.0 ,70.0, 80.0);
		long ret = db.save_infos_GPS(infos); 
		
		now = System.currentTimeMillis();
		infos = new GPS("un", now , 546.0, 9798760.0 ,7650.0, 879880.0);
		ret = db.save_infos_GPS(infos); 
		
		now = System.currentTimeMillis();
		infos = new GPS("un", now , 9999546.0, 136.0 ,88.0, 5555550.0);
		ret = db.save_infos_GPS(infos); 
		
		
		//String requete = "SELECT * FROM table_gps WHERE nom = " + nom ;
		String requete = "SELECT * FROM table_gps"; // WHERE nom = " + nom ;
		
		String nom = "un";
		db.query(nom);
		
	}

	
}
