I have floating action button in my fragment. how can I enable or disable checkboxes inside the recyclerview by using this floating action button. Both recycler view and floating action button are inside the same fragment activity. Also, I need to hide this floating action button upon recyclerview scrolling.
Asked
Active
Viewed 195 times
0
-
2use interface to contact fragment – sasikumar Nov 23 '17 at 09:05
-
If you are receiving button click in activity, then add a `function()` in fragment, then on button click call `fragment.function()` in your activity – Aswin P Ashok Nov 23 '17 at 09:07
-
please show your code – Linh Nov 23 '17 at 09:10
-
how to use interface to contact fragment – Shibin Kalliatt Nov 23 '17 at 09:22
-
you can use ViewModel also. – Sachin Chandil Nov 23 '17 at 09:28
-
I have updated my question. Please review. – Shibin Kalliatt Nov 25 '17 at 05:27
1 Answers
0
For example if you want oo add something to your layout in fragment you can do something like this:
LinearLayout linearLayoutFragment = (LinearLayout)findViewById(R.id.fragmentLayout);
Button button = (Button)findViewById(R.id.buttonid);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//if you want to add something to your Linearlayout fragment
//remove all views for example
linearLayoutFragment.removeAllViews();
}
});

Zaboj Campula
- 3,155
- 3
- 24
- 42

Prince Diouf
- 1
- 1