I am building a page (Xamarin, C #, Android), and I have put a button where the definition of the onclick event, forces me to put it as a private EventHandler. The error that throws me is that "not all the code access paths return a value". On the one hand, I do not understand the error, and on the other, I do not understand the statement as such.
button = new Button
{
Text = "Aceptar",
VerticalOptions = LayoutOptions.CenterAndExpand
};
button.Clicked += Boton_press();
private EventHandler Boton_press3()
{
//
// Guardar datos en archivo
String filename = "*******ruta";
String contenido = "blablabla";
try
{
FileOutputStream test = new FileOutputStream(filename);
byte[] data = Encoding.ASCII.GetBytes(contenido);
test.Write(data);
test.Close();
DisplayAlert("Configuracion", "Configuracion guardada", "Ok");
}
catch (Exception)
{
DisplayAlert("Error", "Error al escribir fichero a memoria interna", "Ok");
}
}