package tdc.edu.vn.test; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Adapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ArrayList data; ListView lvDanhSach; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setControl(); setEvent(); } private void setEvent() { khoiTao(); CustomerAdapterQuocGia adapterQuocGia = new CustomerAdapterQuocGia(this, R.layout.listview_item, data); lvDanhSach.setAdapter(adapterQuocGia); } private void khoiTao() { QuocGia quocGia1 = new QuocGia(); quocGia1.set_tenQuocGia("Viet Nam"); quocGia1.set_danSo("10000"); quocGia1.set_imgQuocKy(R.drawable.congsan); data.add(quocGia1); } private void setControl() { lvDanhSach = findViewById(R.id.lvDanhSach); } }