I am beginner in Android. For onItemCliking i have searched and seen 20+ videos and read 10-15 article about this. At last i have got a 100% explained video. Thank you so much sir 😍😍😍 From Bangladesh
Thank you man I wanted this from long time. I didn't know this method i was searching this method from long on Internet but couldn't find better implementation. Once again thank you.
2021 almost 2022 and this is how you still want to do it. Thank you very much, I spent my whole day angry as fuck because I simple did not knew how to do it.
You are really great. Thank you so much. I wanted this for a long time. I didn't know this method I was searching for this method from long on the Internet but couldn't find better implementation. Once again thank you.
Thank you sir I need your guidance. I want to open new different activity from every item in recyclerview. So I think I should use switch case to perform a task. But I don't know how to do it. Please guide for the same.
thanks for video i have a question if ithem f listview or recyclerview contains three buttons and every button lanch activity diferent of the others how to add a click listener of them thanks again
I have used switch case in Recyclerview to open new activities. When items are not filtered it works perfectly. But when it is filtered wrong activity is opened. I think it happens because filtered items take upper position. It happens due to it. I don't know how to come over it. Please guide about it.
Great tutorial. But I have a question. Can we do that if we click on any movie title and should open a new activity that display the description of that particular movie. For example if I click black panther then it should display the details of black panther and if we click on Iron man then it should display the iron man description. If yes then can you help me? I need it ASAP please
@@mafiacodes thanks a lot for the help... I have one more question that I'am making an app on story, that will show list of story in the list view with the help of API using volley library and recycler view. I also want to implement visitors or views count, meaning whenever a user click on a particular list then it will increment the view by one. For that visitors increment count I have extra API, but I'am confused that where to use that API as post method in adapter class? or in main activity class... Can you help me with this...?
@@mafiacodes reading docs takes much efforts then too after hours of researching I don't find the relevant stuff and if I found that then I don't understand how's that working . Please help 🙏
Its such a great explanation. But, could you explain why do we need an interface instead of making a method(e.g. handleItemClick(int position) ) in MainActivity for handling item click, then creating instance of MainActivity in the Adapter. It would be mainActiviy.handleItemClick(position)
Brother how can i implement recyclerview on click textview text change. Suppose a recyclerview has a 3 textview. I want when i click on whole view one textview show "P" and background color will be green. Another click will be background red and text A. Thank you Please help bro.
Thanks a million bro...its helped me But what if we want to implement clickListener on a single view in recyclerView item (e.g. delete button or favorite button on the recyclerView item)...any help will be appreciated
@@mafiacodes probably he intended starting a new activity, using only one not one for each item, and changing the data shown depending on what item you clicked on, not sure though... ( I could find it very useful too, but I think it's a bit complex)
Do not pass 'this' as a parameter , instead pass the .this , just from having the same problem. i.e. homeQuestionsRecyclerViewAdapter adapter = new homeQuestionsRecyclerViewAdapter(tempSearchQuestionArray, getActivity(), homeFragment.this);
Hey,In item view onclicklistner it is showing me Nonstatic method cannot be referenced from a static context..please help.. Cardonclick.OncardClick(getAdapterpostion()); Here Iam getting problem .OncardClick is showing error as Non static method cant be referenced from static context..
@@mafiacodes i have a question bro. how can I open specific fragment/activity on a specific position and where I need to code in Adapter or fragment/activity? and how ?
You can open it from both places, but the proper way is to open from activity or fragment in which this recycler view resides and that was the whole purpose of this video.
Bro.. can you guide me how to solve my issue.. i stack for 2 day... i have class and method for animate flipcard in myActivity its call. FlipView.flipTheView(); and i want to use this class in my recycleView. if i write code like your video Its work perfectly but its call by manually clicking.. in my case iwant to call this method using another triger not by clicking.. how can i do something like that?
Please Please Please help Hi Sir, Actually, I have two apps in a single project, 1st is a customer app and 2nd one is company app, both apps share the same firebase database. And both the apps are identical in terms of login and registration, When started writing code for the 2nd app, that time I copied 1st project and modified all the activities(android java code) as per my needs. The issue I am facing is when customers register in the customer app and then the same login credentials are being used to login in company app without registering to it or vice-versa. I don't understand why this is happening. I saw one thing that for both the project SHA-1 key is the same after generating from the android studio. I want to restrict login to without registering to it for both the apps, the one should be able to login in the app in which he/she has registered, not in 2nd app where he/she haven't registered, Kindly help me so that I can move forward with my development. Thanks & Regards, Amit Chaudhary
since ur using the same firebase project for authentication, so u cannot protect it, the user can log in with any app, since its using the same firebase auth database...
Sir, please help...OnItemClick successfully worked. But OOnLongClick not working. When I long clicked on an item then the app crashed... here is logcat result : java.lang.NullPointerException: Attempt to invoke interface method 'void com.example.recyclerviewpractice.ROnClickInterface.OnLongItemClick(int)' on a null object reference at com.example.recyclerviewpractice.MyViewHolder$2.onLongClick(MyViewHolder.java:26) Here is the interface: public interface ROnClickInterface { void OnItemClick(int position); void OnLongItemClick(int position); } here is ViewHolder code: itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rOnClickInterface.OnItemClick(getAdapterPosition()); } }); itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { rOnClickInterface.OnLongItemClick(getAdapterPosition()); return true; } }); here is action: @Override public void OnItemClick(int position) { Toast.makeText(this, cityNames.get(position), Toast.LENGTH_SHORT).show(); } @Override public void OnLongItemClick(int position) { cityNames.remove(position); myAdapter.notifyItemRemoved(position); }
Sir give me your address I will come to your place and give you a huge gift with lots of thanks I can't express my happiness I was struggling with this from past 7hours I haven't watched any other video of yours still subscribed 🙂🙂🙂🙂😊😃
I am beginner in Android.
For onItemCliking i have searched and seen 20+ videos and read 10-15 article about this. At last i have got a 100% explained video. Thank you so much sir 😍😍😍
From Bangladesh
after watching more than 8 or 9 videos finally i got it
thanks bro
Glad u like it
@@mafiacodes 3:44 the this argument doesn't work. It provides ValueEventListener instead of recyclerViewClickInterface. What can I do?
No joke, this tutorial saved my butt. Huge huge thanks.
Same
Thank you man I wanted this from long time.
I didn't know this method i was searching this method from long on Internet but couldn't find better implementation.
Once again thank you.
Subscribe like share😊
this tutorial really helped me thanks!!! i was about to giveup and then i saw this video and solved my problem thanks a ton !!!
Awesome explanation
2021 almost 2022 and this is how you still want to do it. Thank you very much, I spent my whole day angry as fuck because I simple did not knew how to do it.
Thank so much for this video.
I finally understand it,
thanks alot
can you make a video about how i can manage my layout for different screen sizes and how to design it?🙏🙏
will you consider one day doing this in kotlin??
Thank you very much sir
great explanation sir... thanks a lot
Thank you bro. Quite easy to understand.
You are really great.
Thank you so much. I wanted this for a long time.
I didn't know this method I was searching for this method from long on the Internet but couldn't find better implementation.
Once again thank you.
Finally, Today I got to know how it works ... Many thanks
this tutorial help me alot thank you bro.
Thank you sir
I need your guidance. I want to open new different activity from every item in recyclerview. So I think I should use switch case to perform a task. But I don't know how to do it. Please guide for the same.
very detail dan it works. thank you
waww. very simple and straight forward. thank you sir.
Great job bro
Subscribe like share
Very Good way to explain
Nice implementation, thanks you
Thank you so much!
Nice clear Explanation.
Thank You
:)
Thank uu. Do you do freelancing??
Yes you can contact me on yourstruly2607@gmail.com
THANKS SO MUCH. YOU SAVE ME
Really explained well bro...!!!!!
Thank you so much
You're most welcome
subscribe like share
this help alot bro
what happen if we implements this interface in two activity classes and call this from recycler view. method from both classes will be called or not?
please use the dark mode for code window. BTW your tutorial are really helpful.
Thank you very much! This was super helpful and so well done! Greatly appreciated!
Glad u like it
How can we use this with checkbox...urrgently needed....please
thanks for video
i have a question if ithem f listview or recyclerview contains three buttons and every button lanch activity diferent of the others how to add a click listener of them
thanks again
thanks bro🙏
I have used switch case in Recyclerview to open new activities. When items are not filtered it works perfectly. But when it is filtered wrong activity is opened. I think it happens because filtered items take upper position. It happens due to it. I don't know how to come over it. Please guide about it.
Watch my video on search filter and see if that helps th-cam.com/video/CTvzoVtKoJ8/w-d-xo.html
Same problems i am facing.
Hello ,Thank you for your knowledge also I have a quesiton
I'm asking to understand why we didn't define onClickte directly inside the viewholder
What if u want to access or do something from activity or fragment? That is why.
@@mafiacodes
thank you for answering
muchas gracias!
super bro plz upload many things from android studio
Watch the entire playlist there’s much more
No sabes cuanto tiempo he buscado hacer esto
me alegro de que te haya gustado, suscríbete como compartir
Sir, which theme r u using? seems nice.
Like the video then i’ll tell 😉
.
.
It is google developers theme
@@mafiacodes Thanks Sir :)
shukria
Great tutorial. But I have a question. Can we do that if we click on any movie title and should open a new activity that display the description of that particular movie. For example if I click black panther then it should display the details of black panther and if we click on Iron man then it should display the iron man description. If yes then can you help me? I need it ASAP please
simply start the new activity
@@mafiacodes thanks a lot for the help... I have one more question that I'am making an app on story, that will show list of story in the list view with the help of API using volley library and recycler view. I also want to implement visitors or views count, meaning whenever a user click on a particular list then it will increment the view by one. For that visitors increment count I have extra API, but I'am confused that where to use that API as post method in adapter class? or in main activity class... Can you help me with this...?
great explanation....but it would have been so easy if google themselves have provided an easy way to do it...!!!!
Please make video for multiple image picker
will try to do that bro...till then SUBSCRIBE LIKE SHARE 😉
tnks
subscribe like share
Aapne kaha se sikha h android development?
Android docs and other stuff on youtube
@@mafiacodes please share some resources
@@mafiacodes reading docs takes much efforts then too after hours of researching I don't find the relevant stuff and if I found that then I don't understand how's that working .
Please help 🙏
Thank! Is working OK
what is getApaterposition?? I can't see all code of adapter class
i am not able to call the RecyclerviewInterface inside my adapter any suggestions?
Its such a great explanation. But, could you explain why do we need an interface instead of making a method(e.g. handleItemClick(int position) ) in MainActivity for handling item click, then creating instance of MainActivity in the Adapter. It would be mainActiviy.handleItemClick(position)
Perfectly wrong 😑, it wud unnecessarily create a memory overhead, and most likely it won’t work as u will have multiple instances of the same activity
for passing interface in fragment "this " is not working , how can i pass interface in fragment like you did in Activity??
basically this represent the activity, so you can pass in your fragments context for "this"
3:44 the this argument doesn't work. It provides ValueEventListener instead of recyclerViewClickInterface. What can I do?
Share code
@@mafiacodes package com.example.popina;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
public class klantMenu extends AppCompatActivity implements HelperAdapter.OnItemListener{ //;hier
private RecyclerView mRecyclerView;
List fetchData;
RecyclerView recyclerView;
HelperAdapter helperAdapter;
DatabaseReference databaseReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_klant_menu);
recyclerView = findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
fetchData = new ArrayList();
String naamRestaurant = getIntent().getStringExtra("naamRestaurant");
databaseReference = FirebaseDatabase.getInstance().getReference("restaurants/users/" + naamRestaurant + "/menu");
databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for(DataSnapshot ds: snapshot.getChildren()){
FetchData data = ds.getValue(FetchData.class);
fetchData.add(data);
}
helperAdapter = new HelperAdapter(fetchData, this);
recyclerView.setAdapter(helperAdapter);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
@Override
public void onItemClick(int position) { //hier
System.out.println(position);
}
}
@@mafiacodes Why do you skip me sir?
Need to share code on GitHub and also mention the problem in readme.md file
@@mafiacodes thanks man but I just fixed it. Thanks anyway!
Brother how can i implement recyclerview on click textview text change. Suppose a recyclerview has a 3 textview. I want when i click on whole view one textview show "P" and background color will be green.
Another click will be background red and text A. Thank you Please help bro.
If you can tell me, how can I use this way for a recyclerview inside another recyclerview,
Implement interface in recycler adapter for child recycler adapter or in main activity or fragment implement the interface
What if we use firebase recycler adapter where we have to initialize interface, in firebaseRecyclerAdapter method above on BindView???
the same way as its described here,,,
Passing "this" to adapter is not accepted, in constructor it asked to cast to valueevent listener, all errors gone but app crashed, any help plz?
how to get details data and send into fragment class
Thanks a million bro...its helped me
But what if we want to implement clickListener on a single view in recyclerView item (e.g. delete button or favorite button on the recyclerView item)...any help will be appreciated
Call the interface method from that onclick view
onclick method open new page (other click same page open but only change data)
I dint get what you wanna know? Please elaborate
@@mafiacodes probably he intended starting a new activity, using only one not one for each item, and changing the data shown depending on what item you clicked on, not sure though... ( I could find it very useful too, but I think it's a bit complex)
It is not working in fragment...
Onclick Interface pass error in fragment
thank you, buti don't know what i am doing wrong its not working for me, i have recyclerview with grid layout manager in a fragment .
Share the code on GitHub
Do not pass 'this' as a parameter , instead pass the .this , just from having the same problem. i.e.
homeQuestionsRecyclerViewAdapter adapter = new homeQuestionsRecyclerViewAdapter(tempSearchQuestionArray, getActivity(), homeFragment.this);
@@ryanben3988 legend !! Thank you Gonna try this
Hey,In item view onclicklistner it is showing me Nonstatic method cannot be referenced from a static context..please help..
Cardonclick.OncardClick(getAdapterpostion());
Here Iam getting problem .OncardClick is showing error as Non static method cant be referenced from static context..
Share code on GitHub
@@mafiacodes solved it bro thanks for reply...❤
thanks buddy :)
Subscribe like share 😊
@@mafiacodes i have a question bro. how can I open specific fragment/activity on a specific position and where I need to code in Adapter or fragment/activity? and how ?
You can open it from both places, but the proper way is to open from activity or fragment in which this recycler view resides and that was the whole purpose of this video.
Bro.. can you guide me how to solve my issue.. i stack for 2 day...
i have class and method for animate flipcard in myActivity its call. FlipView.flipTheView(); and i want to use this class in my recycleView.
if i write code like your video Its work perfectly but its call by manually clicking.. in my case iwant to call this method using another triger not by clicking.. how can i do something like that?
nice sir
Subscribe like share
Boss Please Make Video on How to open the fragment. when we click on the item of recyclerview.
Osm Bro, plz change your android s theme
sir my recycler view is not updating plz help even after trying the notifyItemRemoved
Share code on GitHub
Sir i need how to save images in blob in room db
You can create a column for blob and then can store bytes in that column, the video will come when i start room db somewhr in 4/6days
I'm from indonesia thanks for sharing. Can you make the sub title?
U. An turn on subtitles from TH-cam settings. I guess that would work.
Still same bro, subtitle still nothing
Thanks a lot sir
Subscribe like share 😊
Please Please Please help
Hi Sir,
Actually, I have two apps in a single project, 1st is a customer app and 2nd one is company app, both apps share the same firebase database.
And both the apps are identical in terms of login and registration, When started writing code for the 2nd app, that time I copied 1st project and modified all the activities(android java code) as per my needs.
The issue I am facing is when customers register in the customer app and then the same login credentials are being used to login in company app without registering to it or vice-versa. I don't understand why this is happening. I saw one thing that for both the project SHA-1 key is the same after generating from the android studio.
I want to restrict login to without registering to it for both the apps, the one should be able to login in the app in which he/she has registered, not in 2nd app where he/she haven't registered, Kindly help me so that I can move forward with my development.
Thanks & Regards,
Amit Chaudhary
since ur using the same firebase project for authentication, so u cannot protect it, the user can log in with any app, since its using the same firebase auth database...
Sir, please help...OnItemClick successfully worked. But OOnLongClick not working. When I long clicked on an item then the app crashed...
here is logcat result :
java.lang.NullPointerException: Attempt to invoke interface method 'void com.example.recyclerviewpractice.ROnClickInterface.OnLongItemClick(int)' on a null object reference
at com.example.recyclerviewpractice.MyViewHolder$2.onLongClick(MyViewHolder.java:26)
Here is the interface:
public interface ROnClickInterface {
void OnItemClick(int position);
void OnLongItemClick(int position);
}
here is ViewHolder code:
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
rOnClickInterface.OnItemClick(getAdapterPosition());
}
});
itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
rOnClickInterface.OnLongItemClick(getAdapterPosition());
return true;
}
});
here is action:
@Override
public void OnItemClick(int position) {
Toast.makeText(this, cityNames.get(position), Toast.LENGTH_SHORT).show();
}
@Override
public void OnLongItemClick(int position) {
cityNames.remove(position);
myAdapter.notifyItemRemoved(position);
}
Sir give me your address I will come to your place and give you a huge gift with lots of thanks I can't express my happiness I was struggling with this from past 7hours
I haven't watched any other video of yours still subscribed 🙂🙂🙂🙂😊😃
Thank you, stay tuned...
Thank you very much sir
Thank you so much!