wangjiegulu / RapidFloatingActionButton

Quick solutions for Floating Action Button,RapidFloatingActionButton(RFAB)
Apache License 2.0
1.29k stars 254 forks source link

RapidFloatingActionHelper.build java.lang.NullPointerException #13

Open qinshucheng opened 8 years ago

qinshucheng commented 8 years ago

20160414181132 20160414181307

How to solve this problem? I can successfully run the demo example you give,but when i create a new project,it cause this problem.

I found if I download your file 'library' and use it in my project like 'compile project(':library')' there is no such problem,however this problem exits when I use your library via gradle like this 'compile 'com.github.wangjiegulu:RapidFloatingActionButton:1.0.3' .Can you tell me why??

Bertkiing commented 7 years ago

Maybe you should debug ... ,Though I meet the same problem ,which is my fault . So find it and solve it ,

phuwin1995 commented 7 years ago

You need to initiate rfaLayout and rfaButton. In the author's code, he used AILayout to initiate this. I have googled that but found nothing. So instead I use a normal way to get the views:

 rfaLayout = (RapidFloatingActionLayout) findViewById(R.id.activity_main_rfal);
 rfaBtn = (RapidFloatingActionButton) findViewById(R.id.activity_main_rfab);

Put those before rfabHelper = new ... build() and that should work.