Paging 3 Android Tutorial | Infinite Scrolling Android Tutorial - CheezyCode | Hindi

  Рет қаралды 24,707

Cheezy Code

Cheezy Code

2 жыл бұрын

Android Paging 3 Tutorial in Hindi - Learn Paging 3 in Android with simple example. In this video, we will learn about paging in android. This tutorial covers step by step on how to implement pagination in android. Learn what is Paging Source, what is Pager and Paging Adapter.
We will be calling an API that supports pagination and use it to implement infinite Scroll in Android. Paging Source defines the way to load data from network i.e. API. Once you have paging source setup - you can define a pager object that is used to define the configuration such as pageSize, maxSize. Paging Adapter is used to show this paging data inside recyclerview.
Pagination improves performance of the app by creating only required objects. Recycler view recycles view whereas pagination library creates only the required objects in the memory. Paging 3 Jetpack Component provides support to implement paging in Android. We have implemented it using HILT and MVVM Architecture Pattern. Learn by creating a simple example in Hindi.
Topics covered -
1. What is Paging?
2. What is Paging Source, Pager, Paging Config, Paging Adapter?
3. Paging Implementation Example
4. MVVM + HILT + Paging 3 Jetpack Component.
Complete Dependency Injection Playlist Link -
• Dagger 2 - Dependency ...
Complete Android Architecture Components Playlist -
• Android Architecture C...
Beginner series in Android Playlist (Hindi) -
• Android Tutorials Step...
Kotlin Beginners Tutorial Series -
• Kotlin Beginner Tutori...
For more info - visit the below link
www.cheezycode.com
API Used -
quotable.io/
Source Code -
github.com/CheezyCode/Android...
We are social. Follow us at -
Facebook - / cheezycode
Twitter - / cheezycode
Instagram - / cheezycode

Пікірлер: 127
@aashutoshrimal
@aashutoshrimal Жыл бұрын
Best tutorial I ever watched. Thank you
@ananjaygurjar
@ananjaygurjar 2 жыл бұрын
This channel is goldmine for Android
@CheezyCode
@CheezyCode 2 жыл бұрын
Thank you Ananjay
@AnandSharma-ei1fv
@AnandSharma-ei1fv 3 ай бұрын
Amazing, real work Sir ☺☺☺
@yonija007
@yonija007 Жыл бұрын
Thank you for the amazing explanation. Can we use paging 3 with Firestore data, if yes then how
@pritech8302
@pritech8302 Жыл бұрын
Thankyou so much sir
@RahulYadav-vs2wd
@RahulYadav-vs2wd Жыл бұрын
fun getRefeshKey() always return 1 as per the logic inside it. So the fun load() will always load page 1. I have performed dry run. Pls Clear my doubt if I am wrong.
@rishabhgarg6692
@rishabhgarg6692 Жыл бұрын
Best, Big fan, sir
@suhasbachewar229
@suhasbachewar229 10 ай бұрын
Does this work with different types of viewhholders ?
@UbedThaheem
@UbedThaheem 11 ай бұрын
Thanks for this video, I have few questions & I sent an email to you. First of all, as per your codes, it is showing errors & build failed.. I am trying to get data from SQLite instead of APIs.
@yonija007
@yonija007 9 ай бұрын
What if I want to pass other params as well with PageNo in the API call for eg SearckKey, How can I pass?
@devskhobragade
@devskhobragade Жыл бұрын
Simply superb explanation on Paging! Thanks a lot
@CheezyCode
@CheezyCode Жыл бұрын
Thank you Sandeep
@RahulYadav-vs2wd
@RahulYadav-vs2wd Жыл бұрын
I think there is a logical issue in getRefreshKey() fun. First time this function will return null. Then the position of the page will be 1 and it's prevKey will be null and nextKey will be 2 as per the logic in fun load(). Again there will be callback to function getRefreshKey(). As per the logic in this function you minus 1 from the nextKey and it will become 1 and this value i will be used as a position in function load and this fuction will again request for the same page which we have already loaded. Correct me if I am wrong. you can check by this by debugging or dry run.
@RahulYadav-vs2wd
@RahulYadav-vs2wd Жыл бұрын
In this example if I scroll up. Will this code work?
@rishikeshsingh9946
@rishikeshsingh9946 2 жыл бұрын
awesome sir
@shailysahoo4606
@shailysahoo4606 Жыл бұрын
You are doing a amazing job. I would like to sincerely thank you for making such professional level videos and sharing it here. I am following you and my concepts are getting clear. Would love to get a reply on my comment and also would like to connect as well. Thanks again👏
@CheezyCode
@CheezyCode Жыл бұрын
Thank you 😊You can connect with us on LinkedIn or Twitter.
@DushyantGangwal
@DushyantGangwal Жыл бұрын
Sir, how can we implement this using flow? and how can we notify in paging data adapter using flow?
@RahulYadav-vs2wd
@RahulYadav-vs2wd Жыл бұрын
ye getRefreshKey() function jo h ismey kiya anchor position mee plus 1 ya minus 1 hota h ya phir prevKey ya nextKey mee se plus ya minus karkey return hota h value. Agar anchor position mee plus 1 ya minus 1 hota h tab tu iss function ka logic sahi h hamey desired page milta nahi tu same page milega jo anchor position hold karta h.
@Rm10177
@Rm10177 Жыл бұрын
Such an amazing content. Keep posting more videos!
@CheezyCode
@CheezyCode Жыл бұрын
Thank you 😊
@devgupta7290
@devgupta7290 11 күн бұрын
sir can you provide all your ppts for the revision and refrence
@Sikarwar0020
@Sikarwar0020 2 жыл бұрын
Well Explained Sir Ji 🤩
@CheezyCode
@CheezyCode 2 жыл бұрын
Thanks and welcome
@Kw710v
@Kw710v Жыл бұрын
Sir, can yo make video about pagination with firebasedatabase
@luxurylifestyle143
@luxurylifestyle143 2 жыл бұрын
Thank you sir,i learned lots of things from you videos and got a good job on Android developer with more than 4LPA
@CheezyCode
@CheezyCode 2 жыл бұрын
Well done 👍 Congratulations 👏
@luxurylifestyle143
@luxurylifestyle143 2 жыл бұрын
@@CheezyCode thanku
@surajtutz5742
@surajtutz5742 2 жыл бұрын
@@luxurylifestyle143 where I can contact you?
@luxurylifestyle143
@luxurylifestyle143 2 жыл бұрын
@@surajtutz5742 why do you want to contact me?
@surajtutz5742
@surajtutz5742 2 жыл бұрын
@@luxurylifestyle143 I need job too
@mahboobforever
@mahboobforever Ай бұрын
♥♥♥♥♥♥ sir , live data ki jaga py flow kesy use hoga, main activity me ???? QuoteRepository me to thek ha .flow lag jye ga but ? main Activity me kesy use krein
@hardikkoladiya4431
@hardikkoladiya4431 2 жыл бұрын
Can you please make video on gradle sometimes its confusing in gradle setup or what version of java we should use in project and which gradle version to be set
@CheezyCode
@CheezyCode 2 жыл бұрын
Noted
@aiyuayaan
@aiyuayaan Жыл бұрын
GreatVideo !!!
@mukeshroy4971
@mukeshroy4971 Жыл бұрын
Please sir implement this project using Java code. It will help more people.
@prashupandey1304
@prashupandey1304 Жыл бұрын
Sir You said that we have to create the viewmodelfactory for viewmodel if it has parameter init
@prashupandey1304
@prashupandey1304 Жыл бұрын
but in above case you haven't created it..
@no_one1500
@no_one1500 2 жыл бұрын
Hello brother i have a question so lets say we read files and save it as arraylist as a custom model let say class contain path ,name size and isSelected. from storage lets says images and videos and we have to show these images in two three activies or fragments what should we do ... Like read files on each and every acitivity or fragment... Or make them static. What should we do ...
@CheezyCode
@CheezyCode 2 жыл бұрын
Read files
@virajbenade5572
@virajbenade5572 3 ай бұрын
on the this way we can implement pagination in jetpack compose
@apunichjohncena4533
@apunichjohncena4533 Жыл бұрын
Hello sir, hope you will read this comment. I want to implement pagination for firebase's real-time database. Basically, I want to fetch a single model from the database and show it in viewpager2, after that when the user will scroll the screen it should fetch the model again from the database. After searching for 4 days on the internet, I am posting this comment in the hope that you can help me. Questions-> 1. we fetch data from the cloud in the repository class and here we are also calling PagingSource class from the repository, I can not imagining the flow of code. 2. What will be the key for LoadResult
@CheezyCode
@CheezyCode Жыл бұрын
1. PagingSource is independent of your model class. Paging happens on the model object that you want to show inside your pager. 2. Key depends on the data you are fetching. API should support paging support. (For firebase - Use Firebase Paging Implementation) 3. With/Without DI depends on you. How you have implemented the structure of your app.
@abdulqadir7372
@abdulqadir7372 Жыл бұрын
Sir very informative video. I am facing an issue that is when items get loaded it scrolls down automatically.
@CheezyCode
@CheezyCode Жыл бұрын
it should not....
@jitendrachouhan7024
@jitendrachouhan7024 2 жыл бұрын
Sir, paging 3 multi view type recycler support krta hai kya... Like Social media app does...
@CheezyCode
@CheezyCode 2 жыл бұрын
Yes...adapter mei handling kar skta h
@prashantjain8422
@prashantjain8422 2 жыл бұрын
Thanks for Great Explanation!!. I want to integrate room data and api call together without using remote mediator. Can you please help.
@CheezyCode
@CheezyCode 2 жыл бұрын
without remote mediator 🤔 any specific reason? syncing is tough
@prashantjain8422
@prashantjain8422 2 жыл бұрын
Got a project and the instructor has told not to use it
@rushikeshthak2874
@rushikeshthak2874 2 жыл бұрын
You are great ❤️ i have learned lot of from your channel. ❤️
@CheezyCode
@CheezyCode 2 жыл бұрын
Thank you so much 😀
@opensky2.020
@opensky2.020 Жыл бұрын
Sir firebase realtime database me kese kare. Please ak video chahiye please sir
@kartikayy
@kartikayy Жыл бұрын
Need a video for recyclerview using viewbinding and databinding. Infact need a databinding or viewbinding series
@CheezyCode
@CheezyCode Жыл бұрын
Covered in Notes App Series.check that
@virajbenade5572
@virajbenade5572 3 ай бұрын
Sir you forgot to write viewmodelprovider factory because my viewmodel can not instanciated properly
@khapp7821
@khapp7821 2 жыл бұрын
can we wrap api call with our own safecall api that you used in "to do app"?
@CheezyCode
@CheezyCode 2 жыл бұрын
yes we can
@khapp7821
@khapp7821 2 жыл бұрын
@@CheezyCode please show an example. I am not getting the idea to use the class.
@tinkusony90
@tinkusony90 2 жыл бұрын
🙏 🙏🙏Guruji ✨
@CheezyCode
@CheezyCode 2 жыл бұрын
Thank you 😊
@ViralStoriesShorts
@ViralStoriesShorts 2 жыл бұрын
Hello , Please make video on StateFlow vs. Flow vs. SharedFlow vs. LiveData ....Which is best and why ??
@CheezyCode
@CheezyCode 2 жыл бұрын
soon
@ViralStoriesShorts
@ViralStoriesShorts 2 жыл бұрын
@@CheezyCode Also Make video on Mediator Live Data ??
@nimitagrawal2431
@nimitagrawal2431 Жыл бұрын
this is calling same api again and again and fetching same darta how to stop it
@AmarKumar-vo2bv
@AmarKumar-vo2bv Жыл бұрын
How to create pdf and share to other app?
@rajatdash1474
@rajatdash1474 10 ай бұрын
Hi sir , what happens if we dont have the total page number coming from server ? what will the value of nextKey here ?
@CheezyCode
@CheezyCode 10 ай бұрын
you need to find some logic for the next key...if api does not support paging...then you either need a wrapper api
@codetheandroid
@codetheandroid 2 жыл бұрын
sir ek video caching pe laao jaiseinsta reels me next videos already load ho jati h vaisa kuch krna h . i am using exoplayer . ya koi link dedo kisi tutorial ka isse related. and thank you
@CheezyCode
@CheezyCode 2 жыл бұрын
try github - uspe kuch na kuch clone mil jayega reels ka - For e.g. github.com/Astroa7m/Reels
@kollivenkatamadhukar5059
@kollivenkatamadhukar5059 Жыл бұрын
Suppose our API request contains additional filters and not just page number then how to write the response which you defined at 8:53
@CheezyCode
@CheezyCode Жыл бұрын
Quote Paging Source constructor
@neerajverma9226
@neerajverma9226 5 ай бұрын
Compose ke liyw video banao pagiing ke sath
@naveennaik1889
@naveennaik1889 Жыл бұрын
Hi sir , I am trying to implement the same feature in my project . I am to hit server and get the data properly . . .But after submitting data to adapter , Recyclerview is completely blank . . .
@CheezyCode
@CheezyCode Жыл бұрын
Put a breakpoint and debug it...check the logcat for any errors...
@ksg6284
@ksg6284 Жыл бұрын
using binding
@cryptozink6942
@cryptozink6942 2 жыл бұрын
nice
@CheezyCode
@CheezyCode 2 жыл бұрын
Thanks
@tanveerahmed729
@tanveerahmed729 2 жыл бұрын
Please make s tutorial of upload images and video on server or get frames from a video.
@CheezyCode
@CheezyCode 2 жыл бұрын
upload wala soon for images - video ke frames ke liye kabhi android pe try nahi kiya - JS pe try kar skte hai - ffmpeg se
@Program-withsagar2865
@Program-withsagar2865 10 ай бұрын
Make pagination system using firebase database
@Techjd
@Techjd 2 жыл бұрын
Sir Flows Pe Ek Series Please , and Flows vs LiveData . I am not able to wrap my head around this thing .
@CheezyCode
@CheezyCode 2 жыл бұрын
Yes bro next series
@Techjd
@Techjd 2 жыл бұрын
@@CheezyCode Thanks , Desperately Waiting for Flow Series 🤩 !
@aashishchauhan215
@aashishchauhan215 2 жыл бұрын
Sir Recyerview multiple items selection kaise kare plz help me..
@aashishchauhan215
@aashishchauhan215 2 жыл бұрын
Sir meri comment nhi smj aata kya ? Reply nhi dete ho ?
@CheezyCode
@CheezyCode 2 жыл бұрын
Arre nahi bro...bilkul reply lo bro...karte h iss pe kuch banate h video...
@CheezyCode
@CheezyCode 2 жыл бұрын
Ye cheez waise quiz wali video mei covered hai...
@CheezyCode
@CheezyCode 2 жыл бұрын
kzfaq.info/get/bejne/j9ddjK6AlcuVioE.html
@forester1
@forester1 2 жыл бұрын
Love from Pakistan 🇵🇰
@CheezyCode
@CheezyCode 2 жыл бұрын
Love from India
@forester1
@forester1 2 жыл бұрын
@@CheezyCode ❤️
@Tellthetaless
@Tellthetaless Жыл бұрын
7:15
@rahulsuthar2063
@rahulsuthar2063 Жыл бұрын
Bro live tracking ki ek application bna sakti ho aap jisme live location kise lene hai uske bare me btao and background me usko kise run kare screen off hone ke bad bhi location aate rhe
@CheezyCode
@CheezyCode Жыл бұрын
Nahi bana skte...time taking app hogi...koi nahi dekhne wala
@rahulsuthar2063
@rahulsuthar2063 Жыл бұрын
@@CheezyCode ok but aap guide to kar sakti ho muje kidar se padna hai eski bare me and all
@CheezyCode
@CheezyCode Жыл бұрын
Search GitHub for this keyword - tracking application android - you will surely get the some source code...start from it... Try finding some medium articles...learn about gps tracking in android
@rahulsuthar2063
@rahulsuthar2063 Жыл бұрын
@@CheezyCode ok
@sundern990
@sundern990 2 жыл бұрын
Sir jetpack compose pe bhi series bana do
@CheezyCode
@CheezyCode 2 жыл бұрын
Yes sooner
@MuhammadIbrahim-cc4kb
@MuhammadIbrahim-cc4kb 2 жыл бұрын
Want this with remotemediator
@CheezyCode
@CheezyCode 2 жыл бұрын
will cover that in this series
@Tellthetaless
@Tellthetaless Жыл бұрын
23:20
@aashishchauhan215
@aashishchauhan215 2 жыл бұрын
Sir ML kit text recognition pr tutorial plz..
@CheezyCode
@CheezyCode 2 жыл бұрын
never tried ML kit...ye processing server side he karte hai generally
@aashishchauhan215
@aashishchauhan215 2 жыл бұрын
Okay sir
@aashishchauhan215
@aashishchauhan215 2 жыл бұрын
Sir android studio project Google Drive pr rakhe ya github pr?
@JujareVinayak
@JujareVinayak Жыл бұрын
Pull to refresh list not working.
@CheezyCode
@CheezyCode Жыл бұрын
🤔 implement bhi nahi kiya h
@JujareVinayak
@JujareVinayak Жыл бұрын
@@CheezyCode Paging is working but swipe down to refresh data not reaching adapter.
@GD-ix6gd
@GD-ix6gd 2 жыл бұрын
Agar hmare pass page wise data nahi aarha to kese kare. Like sidha 1000 ka array aata he to
@CheezyCode
@CheezyCode 2 жыл бұрын
api paging support karegi tabhi possible hai
@GD-ix6gd
@GD-ix6gd 2 жыл бұрын
@@CheezyCode oh k.
@GD-ix6gd
@GD-ix6gd 2 жыл бұрын
@@CheezyCode Guruji app real world problem solving ke tutorial bnao, aap to sab android ke components ke tutorial bnate ho
@CheezyCode
@CheezyCode 2 жыл бұрын
Example?
@GD-ix6gd
@GD-ix6gd 2 жыл бұрын
@@CheezyCode like aapne abtak jitni bhi problem face kari hogi us per, and Viewpager 2 with nestedscrollview Fcm with notifications How to setup material chip How to manage Module level app How to setup DOH in retrofit How to write and save data with FileInputstream Autofit recyclerview How to interact with web like web scraping Singleton preferences with dagger How to change base url in retrofit, for only one endpoint. Or abhi to bhot problem he.😅
@TheAqib57
@TheAqib57 2 жыл бұрын
@CheezyCode
@CheezyCode 2 жыл бұрын
Thanks Uno
@RahulYadav-vs2wd
@RahulYadav-vs2wd Жыл бұрын
override fun getRefreshKey(state: PagingState): Int? . The logic return state.anchorPosition?.let { state.closestPageToPosition(it)?.prevKey?.plus(1) ?: state.closestPageToPosition(it)?.nextKey?.minus(1) will always return 1. I think this logic is not correct because at the begning the prevKey = null and the nextKey =2. this is the first page. And in this function you are substracting 1 from the next key because prevKey is null. So it will return 1. Again in override suspend fun load(params: LoadParams): LoadResult params.key will return 1. the prevKey = null and the nextKey =2 again as per the logic inside override suspend fun load(params: LoadParams) function. So it will always make api request for the same page , i.e 1. Are you getting my point?
@CheezyCode
@CheezyCode Жыл бұрын
Getrefreshkey first time pe call nahi hota...put a breakpoint and try to debug...do let me know...will add more info
@RahulYadav-vs2wd
@RahulYadav-vs2wd Жыл бұрын
first time pe agar call nahi hota h tu this function should not return null at all because if it is not called first time , it means page or pages already exist in memory and when page or pages already exist in memory it will never return null. This function also returns null that means it is also called first time and also when you scroll up or down in Recyclerview.
Jetpack Paging 3. Пагинация на Android
35:08
Android Broadcast. Все об Андроид разработке
Рет қаралды 37 М.
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 3,5 МЛН
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 64 МЛН
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 11 МЛН
Paging with Paging 3
11:07
Android Developers
Рет қаралды 55 М.
Android Paging concept - Introduction in Hindi
9:14
Programming Simplified
Рет қаралды 3,6 М.
100+ Linux Things you Need to Know
12:23
Fireship
Рет қаралды 64 М.
Effective ProGuard keep rules for smaller applications (Google I/O '18)
36:32
6 Design Patterns Every Android Developer Must Know
14:16
Philipp Lackner
Рет қаралды 78 М.
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 3,5 МЛН