I have 3 tabs which are fragments and I have a floating action button on one fragment. When I click it nothing happens. I'm pretty new to Android and this is my first attempt at tabs. I really don't understand what Toast wants as the first parameter and why, or why it's not working.
Here's the applicable Java method...
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_my_list, container, false);
FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.floatingActionButton);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getActivity(),"test", Toast.LENGTH_LONG).show();
}
});
return inflater.inflate(R.layout.fragment_my_list, container, false);
}
Here's my .xml file regarding the floating action button...
<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="13dp"
android:layout_marginEnd="14dp"
android:clickable="true"
android:src="@drawable/ic_action_add_exercise"
app:backgroundTint="@color/colorMyBlue" />