Null parameters
Monkey Targets Forums/Android/Null parameters
| ||
Hi. I have a method in class with 6 parameters. 2 of them are float types, one is string. The other 3 are classes. Not all the time I pass the 6 parameters, like this: particula.add(10,10,"brilho_moeda",Null,moeda) And when I try to pass one of the classes as Null or do not pass at all I got this error: I/[Monkey]( 1907): Monkey Runtime Error : java.lang.NullPointerException E/AndroidRuntime( 1907): FATAL EXCEPTION: main E/AndroidRuntime( 1907): java.lang.NullPointerException In other situation, I pass only the 3 first parameters (Float,Float,String) and it works fine, like this: particula.add(10,10,"neve") How do I handle this? Method: Method add(px:Float,py:Float,ptipo:String,pbalao:Baloes=Null,pmoeda:Moedas=Null,pbalao2:Baloes=Null) |
| ||
Well you don't get this because you pass a Null as parameter but you get a null pointer exception because you obviously try to access this instance then in your method. |