Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.mateusz.newapplicationtest_firstlab;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.widget.ArrayAdapter;
- import android.widget.ListAdapter;
- import android.widget.ListView;
- import java.util.ArrayList;
- public class ShowList extends AppCompatActivity {
- public ArrayList<Student> students;
- public ListAdapter mainAdapter;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_show_list);
- students = new ArrayList<>();
- mainAdapter = new ArrayAdapter<Student>(this, android.R.layout.simple_list_item_1, students);
- Student st1 = new Student("Imie_1", "Nazwisko_1");
- Student st2 = new Student("Imie_2", "Nazwisko_2");
- Student st3 = new Student("Imie_3", "Nazwisko_3");
- students.add(st1);
- students.add(st2);
- students.add(st3);
- ListView listView = (ListView)findViewById(R.id.list_item);
- listView.setAdapter(mainAdapter);
- }
- @Override
- protected void onStart() {
- super.onStart();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement