1
How can I set buttons inside the listview, knowing that it creates a button whenever I add an image and a textview to the string array
public View getView(final int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View linha = inflater.inflate(R.layout.linha_de_produto, parent,
false);
ImageButton add_car = (ImageButton) linha.findViewById(R.id.carrinhoButton);
add_car.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// não sei como posso falar para o button que
//ele deve pegar o textview que esta do seu lado na listview
// e jogar pra uma activity, activity dos itens que o cliente selecionou
}
});
return linha
}
And how would I pick it up at the other Activity? la I would form a listview tbm, just with the selected
– Carlos Alberto
getIntent(). getIntExtra("ID_PRODUTO", 0) Being the second parameter 0 a default value! This must be inside the onCreate
– Thiago Luiz Domacoski
Thank you very much :d I was already lost
– Carlos Alberto
Here is another question that deals with how to move from one Activity to another: http://answall.com/questions/131800/android-studio-como-coletar-os-dados-de-outras-telas-e-mostrar-na-ultima-tela/131842#131842
– Thiago Luiz Domacoski
what I return inside the getApplicationContext getter()
– Carlos Alberto
This is a method of your Activity! you need to pass a Context
– Thiago Luiz Domacoski
I passed, now you’re making a mistake on the objectCorrente.getId()
– Carlos Alberto
Which error? how is the objectCurrent ? This object has a getId() ?
– Thiago Luiz Domacoski
Let’s go continue this discussion in chat.
– Carlos Alberto