1
I created a listview where it shows my registered items, as I do so when clicking on the desired item it opens a new screen with the description and details of the item?
Class where displays my table:
public class MostraTodosOsLivrosActivity extends Activity {
private ListView lvMostraTodosOsLivros;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_mostra_todos_livros);
Button btCadastro = (Button) findViewById(R.id.btAbreCadastro);
lvMostraTodosOsLivros = (ListView) findViewById(R.id.lvMostraTodosOsLivros);
btCadastro.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent it = new Intent(MostraTodosOsLivrosActivity.this, CadastroLivroActivity.class);
startActivity(it);
}
});
}
@Override
protected void onResume() {
super.onResume();
DbHelper dbHelper = new DbHelper(this);
List<Livro> listaLivros = dbHelper.selectTodosOsLivros();
ArrayAdapter<Livro> adp = new ArrayAdapter<Livro>(this, android.R.layout.simple_list_item_1, listaLivros);
lvMostraTodosOsLivros.setAdapter(adp);
}
Do you at least already have the screen that will possess these details? I think it’s a little broad your question as it involves starting the Intent, pass the data to it, create a new Activity, its layout and even set the received data.
– Paulo Rodrigues
I have @Paulorodrigues, I was only missing the method that calls the screen. The answer below solved my problem. Still obg by the attention.
– Itallo Freire