Attempt to invoke virtual method


I have this error on my project, “Attempt to invoke virtual method ‘java.lang.Class java.lang.Object.getClass()’ on a null object reference”.

But i cant find where is the problem, i changed the any card clic for any button clic but the problem did not resolve, and do the two procedures from cero again, but the error continues.

The message apperars when i do clic in BotConRec button.


And the question is … :question:

Hi, I posted the question now. Thanks

1 Like

You are trying to invoke something, property for example, on an object, component for example that doesn’t exist. Try to debug your blocks with Do it

I didn’t look at your blocks. I had an equal error and it was this:
I had created a routine within the When Any Cardview Click event and checked just a few ids of some cardviews. So I created other cardviews with new ids and when I clicked on one of them, the event was triggered trying to use the ids of the first card views and did not deal with the ids of the new cardviews.
After several suggestions, @themaayur for it right.

In short: the Click event is being fired, but some components have not yet been created.

1 Like

I found the error with the Do it, but i dont know whats happening.

I have a screen with 3 buttons, paper, pencil and trash, the trash button does not have problem (options image).

I use the same procedure in two different procedures with different names to create Receta cardview in two different vertical scroll arrangement with two different buttons, paper and pencil.

If i clic the pencil button i use the procedure CreaModReceta, that works without problem (pencil button image), but if clic the paper button i use the procedure CreaConReceta (that its the same of procedure of CreaModReceta) the message appear (paper button image).

Did You check , Any Click Event ?

Did You check This error in image ?

Set comdinrec id to 0.

I made that block from 0 again to solve it and the error don’t change, how i can check this error?

I upload the any button clic images, BotModLisRec works fine, but with the same blocks BotConRec dont works


Thanks to all member that try to help me but i finally found the error, i forgot a block that make a calculate with one textbox that the button calls and fills, i upload the block, sorry but its my first time with kodular. :hugs:

Was the problem?
Please explain better so that you can help others.
Was this text box created dynamically?
Were the blocks trying to use these text boxes and hadn’t they been created?

I wil trying to explain the better that i can because my english isnt good.

All components was created dynamically, and i created a block that make a calculate when the textbox TextPesConRec change.

I use the block “when any button.Clic” and this block take the value of the textbox TxtPesConRec and store this value in a variable.

Also i use the block “when any text box change.On text change” to make a calculate with he value from the textbox TxtPorConIng and the textbox TxtPesConRec.

When the procedure creates the dynamic textbox TxtPesConRec, it fills the textbox with the variable stored from the block “when any button.Clic” and at the same time, because the textbox change, calls the event “when any text box change.On text change” and this event was generating the error.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.