package tdc.edu.vn.test; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ListView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ListView lvMain; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setControl(); setEvent(); } private void setEvent() { ArrayList arrList = new ArrayList(); arrList.add(new Nation("Ả rập xê út", "600000", R.drawable.arapxeut)); arrList.add(new Nation("Bra-xin", "800000", R.drawable.brazil)); arrList.add(new Nation("Cam-pu-chia", "45500000", R.drawable.campuchia)); arrList.add(new Nation("Canada", "2000000", R.drawable.canada)); arrList.add(new Nation("Nhật Bản", "9000000", R.drawable.nhatban)); CustomAdapter cusAdapter = new CustomAdapter(this, R.layout.list_view_nation, arrList); lvMain.setAdapter(cusAdapter); } private void setControl() { lvMain = findViewById(R.id.lvMain); } }