Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
Code is for recyclerview I want to implement click operation in child option separately. how should i implement the given code below this code?
this my project code with adapter,child,parent
adapter.java
package com.blipclap.engineering_solution.Adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.bignerdranch.expandablerecyclerview.Adapter.ExpandableRecyclerAdapter; import com.bignerdranch.expandablerecyclerview.Model.ParentObject; import com.blipclap.engineering_solution.Models.TitleChild; import com.blipclap.engineering_solution.Models.TitleParent; import com.blipclap.engineering_solution.R; import com.blipclap.engineering_solution.ViewHolder.TitleChildViewHolder; import com.blipclap.engineering_solution.ViewHolder.TitleParentViewHolder; import java.util.List; public class adapter extends ExpandableRecyclerAdapter<TitleParentViewHolder,TitleChildViewHolder> { LayoutInflater inflater; public adapter(Context context, List<ParentObject> parentItemList) { super(context, parentItemList); inflater=LayoutInflater.from(context); } @Override public TitleParentViewHolder onCreateParentViewHolder(ViewGroup viewGroup) { View view=inflater.inflate(R.layout.list_parent,viewGroup,false); return new TitleParentViewHolder(view); } @Override public TitleChildViewHolder onCreateChildViewHolder(ViewGroup viewGroup) { View view=inflater.inflate(R.layout.list_child,viewGroup,false); return new TitleChildViewHolder(view); } @Override public
Define interface in your adapter class
public interface onItemClickListener { void onItemClicked(View view, int position); } public void setOnItemClickListener(onItemClickListener listener) { this.onItemClickListener = listener; }
On your Custom View Holder Implement View.OnClickListner and set Click Listener for required view.
View.OnClickListner
public static class CustomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { CustomViewHolder(View itemView){ super(itemView); yourview.setOnClickListener(this); } @Override public void onClick(View view) { onItemClickListener.onItemClicked(view, getAdapterPosition()); } }
Now in the Adapter object just add setOnItemClickListener and you can bifurcate click event using the id of the view.
yourAdapter.setOnItemClickListener(new YourAdapter.onItemClickListener() { @Override public void onItemClicked(View view, int position) { // view.getId() });
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.