-6

This is the error message

enter image description here

This is my code

enter image description here

Rohit5k2
  • 17,948
  • 8
  • 45
  • 57
M.Hamdi
  • 15
  • 3
  • 1
    Instead of putting an image, you should paste your code here – tumisma Feb 26 '16 at 09:17
  • Copy paste your error and code. Don't post screenshots. – Rohit5k2 Feb 26 '16 at 09:20
  • 1
    you need to learn basics about layouts and how to inflate that. Just search about those you will get helpful contents – kishorepatel Feb 26 '16 at 09:23
  • 1
    Sometimes I get sad if I see questions like this. I mean you are too lazy to add formatted code but comment your own question 1 minute after you created it? If u read the android documentation this would be trivial to you.. – finki Feb 26 '16 at 09:33

1 Answers1

3

You are trying to find fab in fab, fab1 in fab1 ... You need to get those buttons from root view of your Fragment.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,  Bundle savedInstanceState) {
   View rootView = inflater.inflate(R.layout.carte_reseaux_fragment, container, false);
   fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
   .
   .
   Animation fab_open = AnimationUtils.loadAnimation(getContext(), R.anim.fab_open);
   //Actually FloatingActionButton has own implementation
   fab.setShowAnimation(fab_open);
   return rootView;
}
zgr
  • 176
  • 1
  • 5
  • thank you , it work for fab,fab1,fab2 but not working for fab_open, fab_close ... – M.Hamdi Feb 26 '16 at 10:51
  • Those are animations not a view element. So it seems your implementations was correct for animation initialize. You just have to bind animations to view elements and start. – zgr Feb 26 '16 at 11:12
  • thank you :) , but instead of getContext() you should put getActivity() , I tried it and it works – M.Hamdi Feb 26 '16 at 13:56