public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        Intent intent = new Intent(this, EventsListActivity.class);
        startActivity(intent);
        return true;
      case R.id.idDeleteEvent:
        Log.d("validateLOG", "Borrar evento");

        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle(R.string.app_advice);
        builder.setMessage(R.string.show_event_delete_confirmation);
        EventsSQLiteHelper eventsDB = new EventsSQLiteHelper(this, "eventsDB", null, 1);
        final SQLiteDatabase db = eventsDB.getReadableDatabase();
        final String[] args = new String[] {rowTitle};

        builder.setPositiveButton(
            R.string.app_ok,
            new OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                db.execSQL("DELETE FROM Events WHERE title=?", args);
                db.close();
                Intent i = new Intent(getApplicationContext(), EventsListActivity.class);
                startActivity(i);
              }
            });

        builder.setNegativeButton(
            R.string.app_cancel,
            new OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
              }
            });
        builder.show();
        return true;
      case R.id.idShowMap:

        // implementamos nuestro LocationListener
        LocationManager locationManager =
            (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
        CurrentLocationListener locationListener = new CurrentLocationListener();
        locationManager.requestLocationUpdates(
            LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

        Criteria criteria = new Criteria();
        String provider = locationManager.getBestProvider(criteria, true);

        Location currentLocation = locationManager.getLastKnownLocation(provider);
        if (currentLocation != null) {
          locationListener.onLocationChanged(currentLocation);
        }
        locationManager.requestLocationUpdates(
            provider, (long) 20000, (float) 100, locationListener);

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_show_event);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

    context = this;

    textViewAddress = (TextView) findViewById(R.id.idShowEventAddress);
    textViewCity = (TextView) findViewById(R.id.idShowEventCity);
    textViewDate = (TextView) findViewById(R.id.idShowEventDate);
    textViewReminder = (TextView) findViewById(R.id.idShowEventReminder);
    textViewAlertTone = (TextView) findViewById(R.id.idShowEventTone);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      rowTitle = extras.getString("rowTitle");
    }

    actionBar.setTitle(rowTitle);

    EventsSQLiteHelper eventsDB = new EventsSQLiteHelper(this, "eventsDB", null, 1);
    SQLiteDatabase db = eventsDB.getReadableDatabase();
    String[] campos =
        new String[] {"address", "city", "date", "time", "reminderDate", "reminderTime", "alert"};
    String[] args = new String[] {rowTitle};
    Cursor c = db.query("Events", campos, "title=?", args, null, null, null);

    if (c.moveToFirst()) {
      do {
        address = c.getString(0);
        Log.d("eventLog", address);
        city = c.getString(1);
        Log.d("eventLog", city);
        date = c.getString(2);
        Log.d("eventLog", date);
        time = c.getString(3);
        Log.d("eventLog", time);
        reminderDate = c.getString(4);
        Log.d("eventLog", reminderDate);
        reminderTime = c.getString(5);
        Log.d("eventLog", reminderTime);
        alertTone = c.getString(6);
        Log.d("eventLog", alertTone);
      } while (c.moveToNext());
    }

    db.close();

    completeAddress = address + ", " + city;
    addresses = Utils.getLocationInfo(completeAddress, this);

    textViewAddress.setText(address);
    textViewCity.setText(city);

    // Formateamos date y time para obtener la fecha y la hora en una sola cadena
    String[] rawDate = date.split(" ");
    String[] rawTime = time.split(":");
    String finalDate =
        rawDate[2] + "/" + rawDate[1] + "/" + rawDate[5] + "  " + rawTime[0] + ":" + rawTime[1];
    Log.d("validateLOG", finalDate);
    textViewDate.setText(finalDate);

    // Formateamos reminderDate y reminderTime para obtener la fecha y la hora en una sola cadena
    String[] rawReminderDate = reminderDate.split(" ");
    String[] rawReminderTime = reminderTime.split(":");
    String finalReminderDate =
        rawReminderDate[2]
            + "/"
            + rawReminderDate[1]
            + "/"
            + rawReminderDate[5]
            + "  "
            + rawReminderTime[0]
            + ":"
            + rawReminderTime[1];
    Log.d("validateLOG", finalReminderDate);
    textViewReminder.setText(finalReminderDate);

    // Formateamos la cadena alertTone para obtener el nombre de la alerta
    if (alertTone == null) {
      textViewAlertTone.setText("NINGUNO");
    } else {
      Uri uri = Uri.parse(alertTone);
      Ringtone ringtone = RingtoneManager.getRingtone(this, uri);
      String alertToneName = ringtone.getTitle(this);
      textViewAlertTone.setText(alertToneName);
    }
  }