I'm going crazy to fix input type="file" in static webview. I create a simple webapp in html+js and i'm trying with Android Studio to build a simple webview that load my website url. This is code:
public class MainActivity extends Activity {
private WebView MyWeb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MyWeb =(WebView) findViewById(R.id.webView);
MyWeb.getSettings().setJavaScriptEnabled(true);
MyWeb.getSettings().setSaveFormData(true);
MyWeb.loadUrl("http://phpfileuploader.com/demo/ajax-multiplefiles.php");
MyWeb.setWebViewClient(new WebViewClient());
}
public class myWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
public void onBackPressed() {
if (MyWeb.canGoBack()) {
MyWeb.goBack();
} else {
super.onBackPressed();
}
}
}
I see that all work except input file from html. Need that user upload file image with ext(.png, .jpg, .jpeg) for change their avatar. I read other solution on line about but nothing seems to work! Someone can help me?