I recently implemented a RecyclerView in a fragment and successfully parsed JSON data from a website to display it in the RecyclerView following a helpful tutorial found at:
Now, my next challenge is adding an onClick listener to the items in the RecyclerView. While I have experience with setting onClick listeners for static RecyclerView items, I am unsure how to do so in this scenario. For static items, I typically utilize the following class for handling onClick events.
package com.parassidhu.cdlumaths;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class ItemClickSupport {
// implementation details here...
}
Below is my Adapter Class:
package com.parassidhu.cdlumaths;
import android.content.ClipData;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.parassidhu.cdlumaths.R;
import com.parassidhu.cdlumaths.Android;
import java.util.ArrayList;
public class NoticesData extends RecyclerView.Adapter<NoticesData.ViewHolder> {
// implementation details here...
}