I can not understand something simple, I explain below:
I have the class MainActivity.java (The main one) and then I create another class of name Funcion.java so in the Function class all content (This all empty)
public class Funcion {
}
in the MainActivity class, add the following code:
Funcion f = new Funcion(); //Creo un objeto de la clase funcion
Everything is fine, but now in the class Function I add a function that asks for a parameter with the name of the class:
public class Funcion {
public Funcion(String nombre)
{
String name = nombre;
}
}
Now in the MainActivity class I add the following:
Funcion f = new Funcion();
It gives me an error and it tells me that I must pass a String as a parameter so I must do it like that
Funcion f = new Funcion("Nombre");
I do not understand the usefulness of doing this action and because it is so used in adapters or databases. Do not know what it is for?