setResult () and finish () From RecyclerView Adapter

0

I make a startActivityForResult () from an activity, and I need that from the activity that the user sent to click on one of the cards that I have in a RecyclerView and once clicked it has to return the value to the previous activity, the problem is that the method setResult () and finish () do not work for me, I declare them in the adapter and it does not work for me, this is my code:

Command to call the activity:

private static final int COD_CLIENTE = 21;  
public void cliente(View view){
         Intent intent = new Intent(this, PClientes.class);
         startActivityForResult(intent, COD_CLIENTE);
    }

Once the activity on the adapter starts, I give data to my card from a database, On the onClick I do this:

public void onClick(View itemView) {
        switch (itemView.getId()){
            case R.id.cardClients:
                Intent returnIntent = new Intent();
                returnIntent.putExtra("nombre",nombre);
                // Aqui se supone que iría el setResult() y el finish()
                break;
}

How can I fix it?

    
asked by Humberto Arciniega 02.10.2018 в 17:41
source

0 answers