Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

305
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!