How to get the item id in an onItemClick handler

前端 未结 4 466
花落未央
花落未央 2020-12-16 06:24

I have a category table with two columns category_id and name. I have created a data helper class named CategoryDataHelper. I have a m

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-16 07:17

    Thanks Zack, I could solve with your post...Excelent!!! ... I send a parameter from an activity to another so:

    Intent myIntent = new Intent(Clientes.this, Edc.class);
    Cursor cursor = (Cursor) adapter.getItem(position);
    myIntent.putExtra("CLIENTE_ID", cursor.getInt(cursor.getColumnIndex("_id")));
    startActivity(myIntent);
    

    In the other activity (EDC)....i get the parameter so:

    int _clienteId = getIntent().getIntExtra("CLIENTE_ID", 0);
    

提交回复
热议问题