public void Refresh_button_currentselection()
    {
        state = play_and_learn_scenario._play_scenario_state;
        //State of the application
        switch (state){
        case Play_scenario_state.START_SCREEN:
        case Play_scenario_state.MAIN_MENU:
        case Play_scenario_state.PREFERENCES:
        case Play_scenario_state.MODALITY_MENU:
            //All buttons are not visibles
            button_modality.SetActive(false);
            button_discipline.SetActive(false);
            button_skill.SetActive(false);
            break;
        case Play_scenario_state.DISCIPLINE_MENU:
            button_modality.SetActive(true);
            button_discipline.SetActive(false);
            button_skill.SetActive(false);
            //Text on buttons
            modality = _database.getModality(GlobalVariables.selected_modality_id);
            button_modality.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=modality.name;

            break;
        case Play_scenario_state.SKILL_MENU:
            button_modality.SetActive(true);
            button_discipline.SetActive(true);
            button_skill.SetActive(false);
            //Text on buttons
            modality = _database.getModality(GlobalVariables.selected_modality_id);
            button_modality.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=modality.name;
            discipline = _database.getDiscipline(GlobalVariables.selected_discipline_id);
            button_discipline.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=discipline.name;

            break;
        case Play_scenario_state.HEROE_MENU:
            button_modality.SetActive(true);
            button_discipline.SetActive(true);
            button_skill.SetActive(true);
            //Text on buttons
            modality = _database.getModality(GlobalVariables.selected_modality_id);
            button_modality.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=modality.name;
            discipline = _database.getDiscipline(GlobalVariables.selected_discipline_id);
            button_discipline.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=discipline.name;
            skill = _database.getSkill(GlobalVariables.selected_skill_id);
            button_skill.GetComponent<Button>().GetComponentsInChildren<Text>()[0].text=skill.name;

            break;
        }
    }
    /**
     *  This function gets the modality from its identifier
     *
     *  int modality_id: modality identifier
     *
     *  return: Modality
     *
     **/
    public Modality_Replay getModality(int modality_id)
    {
        IDbConnection dbConnection;
        IDbCommand dbCommand;
        IDataReader reader;

        int user_id = GlobalVariables.user_id;

        connectionString = "URI=file:"+Application.dataPath + "/"+GlobalVariables.user_database;
        dbConnection = new SqliteConnection (connectionString);
        dbConnection.Open ();

        Modality_Replay modality = new Modality_Replay();

        // Select
        string sql = "SELECT * FROM modality AS m ";
        sql += "WHERE m.id ="+modality_id;

        //Debug.Log (sql);
        dbCommand = dbConnection.CreateCommand ();
        dbCommand.CommandText = sql;

        reader = dbCommand.ExecuteReader ();
        while(reader.Read()) {
            int _id = Int32.Parse(reader.GetString(0));
            int _name_int = Int32.Parse(reader.GetString(1));
            string _name = translateText(_name_int,GlobalVariables.locale);
            int _active = Int32.Parse(reader.GetString(2));

            modality = new Modality_Replay(_id,_name,_active);

            //Debug.Log ("activity_id:"+aniamtion.id);
        }

        if (dbCommand != null) {
            dbCommand.Dispose ();
        }
        dbCommand = null;
        if (reader != null) {
            reader.Dispose ();
        }
        reader = null;
        if (dbConnection != null) {
            dbConnection.Close ();
        }
        dbConnection = null;

        return modality;
    }
    /**
     *  This function gets modalities
     *
     *
     *  return: list of Modalities
     *
     **/
    public List<Modality_Replay> getModalities()
    {
        IDbConnection dbConnection;
            IDbCommand dbCommand;
            IDataReader reader;

            int user_id = GlobalVariables.user_id;

            connectionString = "URI=file:"+Application.dataPath + "/"+GlobalVariables.user_database;
            Debug.Log (connectionString);
            dbConnection = new SqliteConnection (connectionString);
            dbConnection.Open ();

            Modality_Replay modality = new Modality_Replay();
            List<Modality_Replay> modalities = new List<Modality_Replay>();
            string sql = "SELECT * FROM modality AS m ";
            sql += "WHERE m.active=0";

            //Debug.Log (sql);
            dbCommand = dbConnection.CreateCommand ();
            dbCommand.CommandText = sql;

            reader = dbCommand.ExecuteReader ();
            while(reader.Read()) {
                int _id = Int32.Parse(reader.GetString(0));

                modality = getModality(_id);
                modalities.Add(modality);
                //Debug.Log ("activity_id:"+activity.id+", skill_id:"+activity.skill_id);
            }

            if (dbCommand != null) {
                dbCommand.Dispose ();
            }
            dbCommand = null;
            if (reader != null) {
                reader.Dispose ();
            }
            reader = null;
            if (dbConnection != null) {
                dbConnection.Close ();
            }
            dbConnection = null;

        return modalities;
    }