0

i have a hybrid app. I used web-view to make a android hybrid app. I also have a native menubar above the webview. My question is, How can i disable the native menu from my web application? Is it possible? If yes please share your thoughts on this

3 Answers 3

1

Check the answer of this question, as they provide snippet code to call Java method from javascript in Android, this will help you if you create a Java method that will disable your ImageButton from a Javascript

Call Java function from JavaScript over Android WebView

Sign up to request clarification or add additional context in comments.

5 Comments

Since there is limitation, I cant change any code from native side. I want to do it only through my web application using javascript.
What limitation? do you have the access to the ImageView in your native code? if so you can disable it. if you don't have the Id of the imageView so there is no way possible for change it's state
Amine ABDALKHALKI - i cant change any code in native but i know the id of ImageButton. All i want is without changing any code in native, i want to disable the Imagebutton from my javascript
from Javascript you can't change a "thing" without calling a native code.. i hope it's clear for you
ohhh :( thank you for responding :) Amine ABDALKHALKI
1

You will need to find the user-agent click here to see how to check useragent then u can write a simple javascript function on page load to disable your header

Comments

1

Try to set webviewclient to your webview and override onPageFinished like this. In my project I tried to hide google and facebook buttons on fitbit page.

    webView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                if (!TextUtils.isEmpty(url) && url.contains("fitbit")) {
                    view.loadUrl("javascript: setTimeout(function () { $('.external-choices,.or').hide();} , 1000) ");//JS to hide the fitbit login from G+ and FB
                }
            }
}

2 Comments

Since there is limitation, I cant change any code from native side. I want to do it only through my web application using javascript.
Could you please post screenshot, if you are trying to hide action bar can't you set the theme of that activity which holds your webview accordingly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.