Pass parameters from one Adapter class to another Activity

Asked

Viewed 118 times

0

I need the help of Voce, create a class called Itensadapter that creates a listview with the database data, until ai blz, now I need to capture this data in another Activity to enter the quantities of these items I will post the code.

public class ItensAdapter extends BaseAdapter {

    private Context ctx;
    private List<buscaItens> lista;

    String qtdItens;

    public ItensAdapter(Context ctx2, List<buscaItens> list2){

        ctx = ctx2;
        lista = list2;

    }

    @Override
    public int getCount() {
        return lista.size();
    }

    @Override
    public buscaItens getItem(int i) {
        return lista.get(i);
    }


    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        View v = null;

        if(view == null){
            LayoutInflater inflater = ((Activity)ctx).getLayoutInflater();
            v = inflater.inflate(R.layout.espelho, null);
        }else{

            v = view;
        }  buscaItens p = getItem(i);



        TextView item = (TextView) v.findViewById(R.id.item);
        Spinner quantidade = (Spinner) v.findViewById(R.id.quantidade);
        TextView codigo = (TextView) v.findViewById(R.id.codigo);

        ArrayAdapter qtd = ArrayAdapter.createFromResource(ctx,R.array.conectores, android.R.layout.simple_spinner_dropdown_item);
        item.setText(p.getItem()+":");
        quantidade.setAdapter(qtd);
        codigo.setText(p.getCodigo());


        return v;



    }
}

How do I upload each item from ListView to another Activity?

EXEMPLO DO LISTVIEW:
item1-------Codigo1------Spinner com quantidades.
item2-------Codigo2------Spinner com quantidades.

I want to pick up these 3 items on another Activity.

  • Different contexts

  • same context, the only thing that changes is that you have to activate the onclick of your list item by passing the Intent inside

  • The context may be different but the solution remains the same.

  • Show guys I will try, remembering that there will not be a click event, the user will choose the values and various spinner and these values will be collected.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.