Posts

Showing posts with the label cardview

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

Recyclerview with Cards example in Android with AppCompat (V7)

Image
I have created a sample application to show RecyclerView and CardView in android with Latest Appcompat Library (V7 Library). Step 1: Import three Libary Project to the Eclipse 1) AppCompat 2) RecyclerView 3) CardView from the folder android-sdk\extras\android\support\v7 Step 2 : Create a new Project/download the Source from below,  and add the three Libary Projects to the MainProject as a Library Projects. 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 ; import android.view.Menu ; import android.view.MenuItem ; import android.widget.Toast ; public class CardViewActivity extends ActionBarActivity { private Toolbar toolbar ; private RecyclerView mRecyclerView ; private RecyclerView . Adapter mAdapter ; private RecyclerView . LayoutManag