0
votes
@Override
public void onBindViewHolder(LiveMatchViewHolder holder, final int position) {


    liveMatchPOJO  currItem = liveMatches.get(position);


    holder.tvTeam1.setText(currItem.getTeam1());
    holder.tvTeam2.setText(currItem.getTeam2());

// holder.timedate.setText(Integer.toString(currItem.getUniqueid()));

    if (prevPos < position) {
        //downwards
        AnimUtil.animate(holder, true);
    }else{
        //upwards
        AnimUtil.animate(holder, false);
    }

    holder.itemView.setOnClickListener(v -> {

        final Intent i;
               i = new Intent(context, Cricket_Categorie.class);
               i.putExtra("unique_id", liveMatches.get(position).getUniqueid());
               i.putExtra("matchStarted", liveMatches.get(position).getMatchStarted());
               i.putExtra("team1",liveMatches.get(position).getTeam1());
               i.putExtra("team2",liveMatches.get(position).getTeam2());
               context.startActivity(i);




    });

    prevPos = position;
}

This is my first code through which i send the Intent how can i receive it on second Adapter

how can i recieve it on second Adapter

@Override public void onBindViewHolder(ViewHolder holder, int position) {

    final Categories_Data_holder listItem = listItems.get(position);
    listItem.getCategories_id();
    holder.biography.setText(listItem.getBio());
    Picasso.with(context)
            .load(listItem.getImageUrl())
            .into(holder.imageView);
    holder.biography.setText(listItem.getBio());

   // Intent i = ((Cricket_Categorie)context).getIntent();


    //Setting OnClickListner on Views:-
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent ii = null;
            switch (position){
                case 0:
           ii = new Intent(v.getContext(), Activity.class);

                    break;

                case 1:
                    ii = new Intent(v.getContext(), ActivityII.class);
                    break;
            }
            context.startActivity(ii);

        }
    });



}

How can I receive text here because through here i need send text to third Activity

2
please attach your code with your questionEL TEGANI MOHAMED HAMAD GABIR
Please add your code with more information.Ali

2 Answers

0
votes

You can send the text to the second activity, store it in some variable and send to third activity from the second when it will be needed.

0
votes

if you want to pass data through intent you should have to pass data to 2nd activity and from 2nd activity pass to 3rd activity Like this:

Intent intent = new Intent(Activity1.this, Activity2.class);
intent.putExtra("EXTRA_DATA", data);
startActivity(intent);

and then get like this in 2nd activity

String data= getIntent().getStringExtra("EXTRA_DATA");

and then pass to 3rd activity like this:

Intent intent = new Intent(Activity2.this, Activity3.class);
intent.putExtra("EXTRA_DATA", data);
startActivity(intent);