protected void Select_Click(){ btnSelect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ArrayList list_author = new ArrayList<>(); ArrayList list_string = new ArrayList<>(); if (txtID.getText().toString().equals("")){ list_author = myDB_helper.getAllAuthor(); } else { list_author = myDB_helper.getAuthor(Integer.parseInt(txtID.getText().toString())); } if (list_author.size() > 0){ for (Author author : list_author){ list_string.add(author.getId_author() + ""); list_string.add(author.getName()); list_string.add(author.getAddress()); list_string.add(author.getEmail()); } ArrayAdapter adapter = new ArrayAdapter(AuthorActivity.this, android.R.layout.simple_list_item_1, list_string); dv_display.setAdapter(adapter); }else { Toast.makeText(getApplicationContext(), "Cơ sở dữ liệu rỗng", Toast.LENGTH_LONG).show(); } } }); }