@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setIcon(R.drawable.buscar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);

    setContentView(R.layout.activity_search);

    nameList = new ArrayList<String>();
    //
    List<String>[] childList = new ArrayList[3];
    String[] headersS = this.getResources().getStringArray(R.array.header_items);
    String[][] childrenS = new String[3][3];
    childrenS[0] = this.getResources().getStringArray(R.array.child_1);
    childrenS[1] = this.getResources().getStringArray(R.array.child_2);
    childrenS[2] = this.getResources().getStringArray(R.array.child_3);

    /*for (int i=0; i<headersS.length; i++) {
        nameList.add(i, headersS[i]);
        childList[i] = new ArrayList<String>();

        for (int j=0; j<childrenS[i].length; j++)
            childList[i].add(j, childrenS[i][j]);

    }*/

    int cont = childrenS[0].length + childrenS[1].length + childrenS[2].length;
    int i = 0;
    while (i < cont) {
      for (int k = 0; k < headersS.length; k++) {
        childList[k] = new ArrayList<String>();

        for (int j = 0; j < childrenS[k].length; j++) {
          childList[k].add(j, childrenS[k][j]);
          nameList.add(i, childrenS[k][j]);
          i++;
        }
      }
    }

    //

    // for simplicity we will add the same name for 20 times to populate the nameList view
    /*for (int i = 0; i < 10; i++) {
        nameList.add("Probando " + i);
    }*/

    // relate the listView from java to the one created in xml
    myList = (ListView) findViewById(R.id.list);

    // show the ListView on the screen
    // The adapter MyCustomAdapter is responsible for maintaining the data backing this nameList and
    // for producing
    // a view to represent an item in that data set.
    defaultAdapter = new MyCustomAdapter(SearchableActivity.this, nameList);
    myList.setAdapter(defaultAdapter);

    // prepare the SearchView
    /*searchView = (android.support.v7.widget.SearchView) findViewById(R.id.search);

    //Sets the default or resting state of the search field. If true, a single search icon is shown by default and
    // expands to show the text field and other buttons when pressed. Also, if the default state is iconified, then it
    // collapses to that state when the close button is pressed. Changes to this property will take effect immediately.
    //The default value is true.
    searchView.setIconifiedByDefault(false);

    searchView.setOnQueryTextListener(this);
    searchView.setOnCloseListener(this);*/

    mDbHelper = new SearchHelper(this);
    mDbHelper.open();

    // Clear all names
    mDbHelper.deleteAllNames();

    // Create the list of names which will be displayed on search
    for (String name : nameList) {
      mDbHelper.createList(name);
    }
  }