Share button html api

I made a website and then converted it into an Android app ( WebView )
And I added a share button in all apps
It works on the web but not in the app
Please solve the problem

You are going to have to do more than that. Tell us more about the share button. It is something you wrote? Did you find it somewhere? How does it work? Have some code to show us? Are you seeing an error? If so, what is the error message?

Just so you know, webview is not your full fledge browser and as said by android.com itself…

It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.

So if your share button is looking to do some fancy things, you will probably want to look for another solution. But again, we don’t know since you really haven’t told us anything about your button, app or how it all works.

thanks
this code for button in site

You have converted this page into webview
But when you press this button in the application, it does not enter the applications to participate
It only works on the web

Ok when you create the webview are you getting the settings and enabling javascript?

WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);

I believe without this you won’t be able to run javascript.

1 Like

This is My Code in java

import androidx.appcompat.app.AppCompatActivity;

import android.net.http.SslError;
import android.os.Bundle;
import android.webkit.ClientCertRequest;
import android.webkit.GeolocationPermissions;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class aeleyn extends AppCompatActivity {
    private WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aeleyn);

        webView = (WebView) findViewById(R.id.webae);
        webView.setWebViewClient(new WebViewClient());

        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setDatabaseEnabled(true);
        webView.getSettings().setDomStorageEnabled(true);
        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        webView.getSettings().setGeolocationEnabled(true);

        webView.loadUrl("*******************");

    }

    @Override
    public void onBackPressed() {
        if (webView.canGoBack()) {
            webView.goBack();
        }else {
            super.onBackPressed();
        }
    }
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.