Posts

Showing posts with the label Recycler view with OnClick Implementation with AppCompat

RecyclerView with onClick and onLongClick implemtation in android example

Image
In the Previous Post , We have create list of items with RecyclerView using appcompat v7. Now, we have implemented onclick event functionality in the previous post for each list item using stackoverflow link. Now, I have update the code to latest Android Api RecyclerView default way of implementing onClick and onLongClick on the each item. Step 1 : Create an Activity with recyclerview CardViewActivity.java package com . pratap . cardviews1 ; import android.os.Bundle ; import android.support.v7.app.ActionBarActivity ; import android.support.v7.widget.LinearLayoutManager ; import android.support.v7.widget.RecyclerView ; import android.support.v7.widget.Toolbar ; public class CardViewActivity extends AppCompatActivity { private Toolbar toolbar ; private RecyclerView mRecyclerView ; private RecyclerView . Adapter mAdapter ; private RecyclerView . LayoutManager mLayoutManager ; @Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( sa

Recycler view with OnClick Implementation with AppCompat

Image
In the Previous Post, We have create list of items with Recyclerview using appcompat. Now, we have implemented onclick event for each list item.. Clicking on the item , shows you a small toast with data. I have used the implementation in this project from the following link. // Implementation of onItemClick RecycleView // http://stackoverflow.com/questions/24471109/recyclerview-onclick/26196831#26196831 Please see the update Source code