The code isn’t being executed because your if (instance != null)
statement isn’t true. If you want that code to run, and you don’t want to have a NullPointerException then initialise whichever variable is null (i.e. give it a value). At that point you can remove the null check as well as it will no longer be needed.
Post your code if you want a more detailed answer.
3
solved Null Point exception