rjsvieira / floatingMenu

An orbit-like action button
Apache License 2.0
305 stars 42 forks source link

Sample with clicklistener #13

Closed hiramcastrod closed 6 years ago

hiramcastrod commented 6 years ago

Hi can you add to the sample a ClickListener for the FloatingSubButtons please?

rjsvieira commented 6 years ago

Hello @hiramcastrod

That feature is already implemented. You can simple use findViewById() to get the subButton you want and proceed to set a clickListener on it.

Regards,

hiramcastrod commented 6 years ago

Hello @rjsvieira , have you ever implemented inside a fragment? it seems like is not working, Null pointer exception error appears, i tried validate it inside "if(FloatingMenu.isOpen())" and a try/catch(nullpointerException)" but nothing happends

hiramcastrod commented 6 years ago

i get this error when i put the code inside a FloatingMenu Clicklistener : E/rjsv.floatingmenu.floatingmenubutton.FloatingMenuButton: Attempt to invoke virtual method 'android.view.View rjsv.floatingmenu.floatingmenubutton.subbutton.FloatingSubButton.findViewById(int)' on a null object reference... even if i reference the floatingSubButtons there

rjsvieira commented 6 years ago

Hello @hiramcastrod Yes, I have implemented in both activities and fragments and worked in both situations. The null pointer exception indicates that somehow you are not being able to identify the view through "findViewById()". That or the view could be being null'ed before reaching the setOnClickListener. Can you share that part of code so I can help you debug it? Regards,