Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
How can I pass null from react native to java when I develop a module

I'm developing a native module for Android in React Native. I have two method with the same name but I can't use them in React Native because Java Script has not overloading directly. So I write a function which can get null as a paramater in React Native and try to handle it in Java.

React Native side:

    function a(arg=null){
       moduleName.b(arg)
    }

Java side:

public void b(@Nullable Boolean arg, final Promise promise){
  if(arg == null){
    c()
  }else{
    c(arg)
  }
}

Then I have not problem when I pass true or false to function a but when I pass nothing to funtion a I get an error on my phone like that:

error

What is the problem?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This can be due to multiple things going wrong into code. Some areas which needs to look are:

  • use boolean instead of Boolean in your Java code.
  • try checking if your getIntent() function is not returning null intent , just before receiving intent from bundle.
  • You are trying to check Boolean with null , that's why it's throwing java.lang.Boolean on a null object reference.
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda