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

102
Views
How To remove unwanted section in kotlin Webview Android Studio

I am converting my wordpress website in to android application using webview in kotlin, and i want to remove(hide) the header of the website in the app version, I have try so many search and i found a way to did it by injecting javascript in the
onpagefinish function, but it didnt work, this is my code with the options i have try

   **val v: View = inflater.inflate(R.layout.fragment_home, container, false)
        val webView = v.findViewById<View>(R.id.webview) as WebView
        webView.webViewClient = object : WebViewClient() {
            override fun onPageFinished(view: WebView?, url: String?) {

             //   the first code i try for hiding the header
                //   webView.loadUrl("javascript:(function() { var a= document.getElementsByTagName('menu-pusher');a[0].hidden='true';a=document.getElementsByClassName('menu-pusher');a[0].style.padding='0px';})()")

             //  the second code i try for hiding the header
                //   webView.loadUrl("javascript:if (typeof(document.getElementsByClassName('menu-pusher')[0]) != 'undefined' && document.getElementsByClassName('menu-pusher')[0] != null){document.getElementsByClassName('menu-pusher')[0].style.display = 'none';} void 0");

                /* The Third Code i have try for hiding the header
                webView.loadUrl("javascript:(function() { " +
                        "var head = document.getElementsByClassName('menu-pusher')[0].style.display='none'; " +
                        "})()");*/

            //The Last Code i have try
                webView.loadUrl("javascript:document.getElementsByClassName('menu-pusher')[0].style.display='none'");
        }
        }
        //the webpage i am trying to load and hide the header

        webView.loadUrl("https://sadeeqtech.com.ng/stech")
        return v
    }
}

But please guys if there is another better way to convert my wordpress website into an Android app apert from webview, please help me with it but using kotlin

almost 4 years ago · Santiago Trujillo
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!