SQLite Cursor Finalizing
===

My SDLite Database is composed of 5 String : Age, Sexe, Lieu, Form, User_profil.

Dans mon activité de démarrage de l'application j'ai ceci:

 

    public class SplashScreenActivity extends Activity
    {
    	@Override
    	public void onCreate(Bundle savedInstanceState)
    	{
    		
    		// Must be first instruction of onCreate.
    		super.onCreate(savedInstanceState);
    		
    		// Show Splash screen.
    		setContentView(R.layout.splash_screen);
    		
    		// Starting Internal BDD
    		UserBDD userbdd = new UserBDD(this);
    		userbdd.open();
    		userbdd.removeAllContentUser();
    		
    		//check si l'application est cree pour la premiere fois et si oui on cree le premier user en BDD
    		if (userbdd.getUser() == null)
    		{
    			User user_start = new User();
    			userbdd.insertUser(user_start);
    		}
    		final User userfrombdd = userbdd.getUser();
    		userbdd.close();
    		
    		// Create and run thread.
    		Thread splashThread = new Thread()
    		{
    			@Override
    			public void run()
    			{
    				try
    				{
    					int waited = 0;
    
    					//while(waited < 5000)
    					while(waited < 500)
    					{
    						sleep(50);
    						waited += 100;
    					}
    				}
    				catch( InterruptedException e )
    				{
    					e.printStackTrace();
    				}
    				finally
    				{
    						// check si la variable form est true ou false -> la personne a soit passee soit validee le formulaire
    					    if (userfrombdd.getForm().equals("true"))
    						{
    							Intent intent_to_main = new Intent(SplashScreenActivity.this, OngletsActivity.class);
    							startActivity(intent_to_main);
    							finish();
    						}
    					    else
    					    {
    							Intent intent_to_pref = new Intent(SplashScreenActivity.this, UserScreen.class);
    							startActivity(intent_to_pref);
    							finish();
    					    }
    				}
    			}
    		};
    		splashThread.start();
    	}
    }


My Application is fine working but i have this error log message :
 

    07-18 19:33:56.754: E/Cursor(10763): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.dev.prixo/databases/data.db, table = table_user, query = SELECT SEXE, AGE, QUARTIER, USER_PROFIL, FORM FROM table_user
    07-18 19:33:56.754: E/Cursor(10763): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
    07-18 19:33:56.754: E/Cursor(10763): 	at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1229)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1184)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1264)
    07-18 19:33:56.754: E/Cursor(10763): 	at com.dev.prixo.SQLite.UserBDD.getUser(UserBDD.java:97)
    07-18 19:33:56.754: E/Cursor(10763): 	at com.dev.prixo.SplashScreenActivity.onCreate(SplashScreenActivity.java:32)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.os.Looper.loop(Looper.java:123)
    07-18 19:33:56.754: E/Cursor(10763): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
    07-18 19:33:56.754: E/Cursor(10763): 	at java.lang.reflect.Method.invokeNative(Native Method)
    07-18 19:33:56.754: E/Cursor(10763): 	at java.lang.reflect.Method.invoke(Method.java:521)
    07-18 19:33:56.754: E/Cursor(10763): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    07-18 19:33:56.754: E/Cursor(10763): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    07-18 19:33:56.754: E/Cursor(10763): 	at dalvik.system.NativeStart.main(Native Method)

I close my cursor after to have created it in order to do getUser(), i don't understand, you can see my code beelow of my UserBDD class:

    public class UserBDD 
    { 
    	private static final int VERSION_BDD = 1;
    	private static final String NOM_BDD = "data.db";
     
    	private static final String TABLE_USER = "table_user";
    	
    	private static final String COL_AGE = "AGE";
    	private static final int NUM_COL_AGE = 0;
    	
    	private static final String COL_SEXE = "SEXE";
    	private static final int NUM_COL_SEXE = 1;
    	
    	private static final String COL_QUARTIER = "QUARTIER";
    	private static final int NUM_COL_QUARTIER = 2;
    	
    	private static final String COL_USER_PROFIL = "USER_PROFIL";
    	private static final int NUM_COL_USER_PROFIL = 3;
    	
    	private static final String COL_FORM = "FORM";
    	private static final int NUM_COL_FORM = 4;
     
    	private SQLiteDatabase bdd;
    	private BaseSQLite maBaseSQLite;
    	
    	public UserBDD(Context context)
    	{
    		//On créer la BDD et sa table
    		maBaseSQLite = new BaseSQLite(context, NOM_BDD, null, VERSION_BDD);
    	}
     
    	public void open()
    	{
    		//on ouvre la BDD en écriture
    		bdd = maBaseSQLite.getWritableDatabase();
    	}
     
    	public void close()
    	{
    		//on ferme l'accès à la BDD
    		bdd.close();
    	}
     
    	public SQLiteDatabase getBDD()
    	{
    		return bdd;
    	}
     
    	public long insertUser(User user)
    	{
    		//Création d'un ContentValues (fonctionne comme une HashMap)
    		ContentValues values = new ContentValues();
    		
    		//on lui ajoute une valeur associé à une clé (qui est le nom de la colonne dans laquelle on veut mettre la valeur)
    		values.put(COL_SEXE, user.getSexe());
    		values.put(COL_AGE, user.getAge());
    		values.put(COL_QUARTIER, user.getQuartier());
    		values.put(COL_USER_PROFIL, user.getUser_profil());
    		values.put(COL_FORM, user.getForm());
    		
    		//on insère l'objet dans la BDD via le ContentValues
    		return bdd.insert(TABLE_USER, null, values);
    	}
     
    	public int updateUser(User user)
    	{
    		ContentValues values = new ContentValues();
    		values.put(COL_SEXE, user.getSexe());
    		values.put(COL_AGE, user.getAge());
    		values.put(COL_QUARTIER, user.getQuartier());
    		values.put(COL_USER_PROFIL, user.getUser_profil());
    		values.put(COL_FORM, user.getForm());
    		
    		return bdd.update(TABLE_USER, values, null, null);
    	}
     
    	public int removeAllContentUser()
    	{
    		System.out.println("\nDonnees suprimees.\n");
    		//Suppression des info User
    		return bdd.delete(TABLE_USER, null, null);
    	}
     
    	public User getUser()
    	{
    		Cursor c = bdd.query(TABLE_USER, new String[] {COL_SEXE, COL_AGE, COL_QUARTIER, COL_USER_PROFIL, COL_FORM}, null, null, null, null, null);
    		
    		return cursorToUser(c);
    	}
    	
    	public String AfficheUserInfo()
    	{
    		Cursor c = bdd.rawQuery("SELECT * FROM table_user", null);
    		String query = c.getString(c.getColumnIndex("SEXE"));
    		c.close();
    		return query;	
    	}
    	
    	private User cursorToUser(Cursor c)
    	{
    		//si aucun élément n'a été retourné dans la requête, on renvoie null
    		if (c.getCount() == 0)
    			return null;
     
    		//Sinon on se place sur le premier élément
    		c.moveToFirst();
    		//On créé un livre
    		User user = new User();
    		
    		//on lui affecte toutes les infos grâce aux infos contenues dans le Cursor
    		user.setSexe(c.getString(NUM_COL_SEXE));
    		user.setAge(c.getString(NUM_COL_AGE));
    		user.setQuartier(c.getString(NUM_COL_QUARTIER));
    		user.setUser_profil(c.getString(NUM_COL_USER_PROFIL));
    		user.setForm(c.getString(NUM_COL_FORM));
    		
            //On ferme le cursor
    		c.deactivate();
    		c.close();
    		//On retourne le livre
    		return user;
    	}
    }

Thanks to help me guys!