0

i have to create a web view of my application i added the code for open file in open file button but i need to select camera or gallery option when i click open file button here is the i added for select file option

protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mWebView = (AdvancedWebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setLoadWithOverviewMode(true);

    mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    mWebView.setScrollbarFadingEnabled(false);
    mWebView.getSettings().setBuiltInZoomControls(true);
    mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
    mWebView.getSettings().setAllowFileAccess(true);
    mWebView.getSettings().setSupportZoom(true);

    mWebView.loadUrl("http://samanaretail.website/inv/");


}





 @Override
protected void onResume() {
    super.onResume();
    mWebView.onResume();
    // ...
}



@Override
protected void onPause() {
    mWebView.onPause();
    // ...
    super.onPause();
}
protected void onDestroy() {
    mWebView.onDestroy();
    // ...
    super.onDestroy();
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    mWebView.onActivityResult(requestCode, resultCode, intent);
    // ...
}

}

i added the permission for acces camera and write external file but i can't acces the camera please help me to find the solutiion

fresher
  • 1
  • 5

1 Answers1

0

Firstly use this reference answer : Webview's Html button click detection in Activity(java code)

& once you receive callback through JavascriptInterface, Use this library below:

https://github.com/coomar2841/android-multipicker-library

I have used it in my application & that helped me a lot.

buzzingsilently
  • 1,546
  • 3
  • 12
  • 18