I'm trying to fill a List with values from 1 to 10 through a FOR loop and using a method.
The Commit class receives the value of "i" and the method returns the List. Look:
private List compromissos() {
String titulo = null;
List al = Arrays.asList(new Compromisso(titulo));
for(int i=0; i<10;i++){
new Compromisso(String.valueOf(i));
}
return al;
The Commitment class looks like this:
public class Compromisso {
private String titulo;
public Compromisso(String titulo) {
this.titulo = titulo;
}
public String getTitulo() {
return titulo;
}
public void setNome(String nome) {
this.titulo = titulo;
}
@Override
public String toString() {
return "Título: " + titulo;
}
}
Then I try to populate a listView:
...
List compromissos = compromissosAgendados();
AdapterCompromissosPersonalizado adapter = new AdapterCompromissosPersonalizado(compromissos, this);
...
However, when you run the program, nothing is shown in the listView.
I wonder where I went wrong.
I do not know why I was very clear.