Android Question FloatingActionButton error

leitor79

Active Member
Licensed User
Hi,

I tried to put a FAB into an activity and I'm getting an error when I open it:

B4X:
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Receiver (recordatorservice) OnReceive **
** Service (recordatorservice) Start **
** Activity (layrecord) Create, isFirst = true **
layrecord_activity_create (java line: 348)
java.lang.RuntimeException: android.content.res.Resources$NotFoundException: Resource ID #0x0
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at eitorteam.recordator.layrecord._activity_create(layrecord.java:348)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
    at eitorteam.recordator.layrecord.afterFirstLayout(layrecord.java:104)
    at eitorteam.recordator.layrecord.access$000(layrecord.java:17)
    at eitorteam.recordator.layrecord$WaitForLayout.run(layrecord.java:82)
    at android.os.Handler.handleCallback(Handler.java:907)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:216)
    at android.app.ActivityThread.main(ActivityThread.java:7625)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
    at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:301)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:1073)
    at android.content.res.Resources.getDrawable(Resources.java:1013)
    at android.content.res.Resources.getDrawable(Resources.java:988)
    at com.github.clans.fab.FloatingActionButton.setImageResource(FloatingActionButton.java:866)
    at de.donmanfred.FloatingActionButtonWrapper.setIconDrawable(FloatingActionButtonWrapper.java:140)
    at de.donmanfred.FloatingActionButtonWrapper.DesignerCreateView(FloatingActionButtonWrapper.java:65)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:70)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 14 more
I've even copied the Resource folder, as in the example, and added the #additionalres clause.

Thank you,
 

leitor79

Active Member
Licensed User
Hi,

Thank you for your help, but I'm having the same issue with your sample.
I'm not sure about the right steps to follow in order to implement the FAB into my project.
1) Added the library (1.02, b4a v9.3)
2) Copied the "Resource" folder from your example to my project folder.
3) Added the #AdditionalRes: ..\Resource line.

I am missing something...?

Thank you
 

leitor79

Active Member
Licensed User
Hi Erel,
It was the first result when I searched for a floatingactionbutton; I didn't know then that there was another implementation.
Also; I'd like to learn to solve the problems I'm facing. I'm not comfortable with copying and pasting solutions without understanding what I've done.

Regards,
 
Top