I'm trying to create an Android app for my web system. This is my first try at Android Studio. I followed a few tutorials and made up something.
So when I open the app it opens my web system within the app.
There is a section that uploads images, but when I click it, it won't open and ask for a gallery or camera.
I would like to know how to do it.
I'm using Android Studio for this and these are the current codes.
MainActivity.java
public class MainActivity extends AppCompatActivity {
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = findViewById(R.id.webview);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://www.mysitenamegoeshear.com/");
WebSettings websettings = webView.getSettings();
websettings.setJavaScriptEnabled(true);
}
private class MyWebView extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
return super.shouldOverrideUrlLoading(view, request);
}
}
@Override
public void onBackPressed() {
if (webView.isFocused() && webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
}
This is how it opens in the mobile browser. Here when It clicks to Choose File
This pop-up appears. I want to do the same in my web view also.