Q:

Sending variable from Adapter to Activity

In my app I use a CardView. When a card is clicked, another activity opens which needs the id of the card. So I tried to send the data through the intent which I'm using to open the activity as well.
My problem is that the received value in the receiving class always stays 0, although the shared value is different. Am I getting it wrong?
The part of the adapter:
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {

    final int a = dataAdapter.getId();

    holder.cardView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent intent = new Intent(context, ChatActivity.class);
            intent.putExtra("CardID", a);
            context.startActivity(intent);
        }
});

The second class that gets the value:
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chat_layout);

        Intent intent = getIntent();
        int cardId = intent.getIntExtra("cardID", 0);
        Log.d("cardId = ", String.valueOf(cardId)); 
}

A:

When u are inserting, CardID "C" is uppercase while when u are getting it cardID "c" is lowecase.It is case sensitive just make them both the same case and that should work. 

