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

277
Views
Error: Java exception was raised during method invocation

I got an error when js invoke Android's native method on android 5,6,7

Error: Java exception was raised during method invocation

From javascript I am calling native android's method like this:

Android.setIsGoBack(true);

and on android side I have this method in abstract class like:

@JavascriptInterface
override fun setIsGoBack(isGoBack: Boolean) {
     (activity as DashBoardActivity).isGoBack = isGoBack
     (activity as DashBoardActivity).setHeader("")
}

and I am not sure what is actually getting wrong on Android 5,6,7.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I have fixed the above issue. The problem was I was calling the method from javascript and updating UI (activity as DashBoardActivity).setHeader("") in some other thread than UI. So changed my method to:

 @JavascriptInterface
    override fun setIsGoBack(isGoBack: Boolean) {


        activity?.runOnUiThread {
            (activity as DashBoardActivity).isGoBack = isGoBack
            (activity as DashBoardActivity).setHeader("")
        }
    }

updating UI on main thread worked for me.

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!