Pick up time and tell the user

2

I created this code in Android Studio to inform bus time from here in my city but I wanted the app to tell you what the next bus you could get as soon as it accessed the list view and I have no idea how to do it .

Here is the code for the list view:

public class Roncoroni extends AppCompatActivity {

    private ArrayList<TemOnibusTeste> adicionarOnibus() {

        ArrayList<TemOnibusTeste> onibusTestes = new ArrayList<TemOnibusTeste>();
        TemOnibusTeste e = new TemOnibusTeste("Segunda a sexta", "");
        onibusTestes.add(e);

        e = new TemOnibusTeste("Bairro          Centro", "");
        onibusTestes.add(e);

        e = new TemOnibusTeste("05:50             N/A*", "");
        onibusTestes.add(e);

        e = new TemOnibusTeste("N/A* = Não fica parado no Centro. Chega e sai.", "");
        onibusTestes.add(e);

        return onibusTestes;

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.petroita_roncoroni);

        ListView lista = (ListView) findViewById(R.id.ListViewId);
        ArrayAdapter adapter = new TemOnibusAdapter(this, adicionarOnibus());
        lista.setAdapter(adapter);

    }
}

It would look something like this:

Thisisaprintfrommyapp:

Testing Class:

public class TemOnibusTeste {

    private String nome;
    private String via;

    public TemOnibusTeste(String nome, String via) {
        this.nome = nome;
        this.via = via;

    }

    public TemOnibusTeste(String s) {
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getVia() {
        return via;
    }

    public void setVia(String via) {
        this.via = via;

    }
}
    
asked by anonymous 30.10.2017 / 00:29

0 answers