Webview InputText not supported in 2.1 and 2.2 - android

In Android we have an url
"http://offers.bartizan.com/we-want-ileads-at-our-shows"
which contains lot of data.
We load this url in webview, In android 2.3 and onwards its working fine means diplay all content of url data but in android 2.1 and 2.2 not display Input Text form.
Here is my code which i used to load url in webview.
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setRenderPriority(RenderPriority.HIGH);
webView.enablePlatformNotifications();
webView.getSettings().setCacheMode(android.webkit.WebSettings.LOAD_DEFAULT);
webView.loadUrl("http://offers.bartizan.com/we-want-ileads-at-our-shows");
webView.setWebViewClient(new WebViewClient(){
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//if(url.contains("http://www.youtube.com/embed/")){
Log.d("WBC", "This is a YouTube link: " + url);
Log.e("url---Video->", url);
view.loadUrl(url);
return true;
} });
class MyJavaScriptInterface {
public void showHTML(String html) {
String htmlString = html;
Log.e("<---MyJavaScriptInterface---showHTML----->", htmlString);
}
}
Below form not display in android OS. 2.1 and 2.2
First name *
Last name
Email address *
List the names of your shows here. Please include the show manager name, email and phone. *
1) Showing blank area above image
2) Textbox we require

Related

Webview webcontent not loading

I am trying to load some HTML content (it is a hyperlink) in WebView. But when I click that link nothing is opening. But the same link is working in browser or iOS WebView perfectly.
The code I try:
htmlContent.getSettings().setJavaScriptEnabled(true);
htmlContent.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
htmlContent.loadDataWithBaseURL(null, Html.fromHtml(categoryItemsBean.getContent()).toString(), "text/html", "utf-8", null);
Value of categoryItemsBean.getContent().
<p><a title="كتاب مساعدة الأصدقاء"
href="https://www.manhal.com/platform/stories/demo/index.php?storyid=31"
target="_blank">كتاب مساعدة الأصدقاء </a></p>
Using loadData() method for loading html content on webview
Sample
String unencodedHtml ="<html><body>'%23' is the percent code for ‘#‘ </body></html>";
String encodedHtml = Base64.encodeToString(unencodedHtml.getBytes(),Base64.NO_PADDING);
htmlContent.loadData(encodedHtml, "text/html", "base64");
Convert your html content into base64

NativeCrashListener: Exception dealing with report android.system.ErrnoException: read failed: EAGAIN

I'm trying to generate an HTML file in order to print it later on, on a specific android tablet (Android 5.1.1), If the HTML file contains Arabic letters the HTML viewer and the app crashes.
after generating the HTML i make a print job to print it, then the android print adapter opens and try to render the Arabic HTML, the app crashes here with the error shown above.
Please help..
My code..
WebSettings webSetting = webview.getSettings();
webSetting.setJavaScriptEnabled(true);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setDisplayZoomControls(false);
htmlWebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
Toast.makeText(getActivity(), "finished" , Toast.LENGTH_LONG).show();
}
#Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
Toast.makeText(getActivity(), "Error: " + error , Toast.LENGTH_LONG).show();
}
});
webView.loadUrl("file:///" + Environment.getExternalStorageDirectory() + "/reports/genFiles/" + filename);

Android Studio Assets file cannot be accessed in WebView

I have been trying to figure out almost 2 weeks.
I have read previous posts and tried the proposed solutions but they didn't work for me.
Iam using Android Studio, I need Webview to access a local Jpg stored in Android Assets file.
Here is my code:
webView = (WebView) findViewById(R.id.webview);
startWebView("file:///android_asset/railchinese.jpg");
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
private void startWebView(String url) {
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl(url);
Here is the Assets location screen:
Kindlly let me know where is the mistake?..
Try this
String htmlData="<img src= railchinese.png>";
webView.loadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "utf-8", null);

Pdf view android studio

Hello community wanted to know how to view a PDF file in android api eight studio try these codes but can not = (someone tell me what's wrong? ..
I get all the WebView blank
  thanks
WebView wv = (WebView)findViewById(R.id.webView2);
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
wv.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//view.loadUrl(url);
return super.shouldOverrideUrlLoading(view, url);
}
});
wv.loadUrl("www.ues.mx/Docs/alumnos/movilidad/Ejemplo%20de%20Curr%C3%ADculum%20Vitae.pdf");
wv.getSettings().setUseWideViewPort(true);
another way
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("www.ues.mx/Docs/alumnos/movilidad/Ejemplo%20de%20Curr%C3%ADculum%20Vitae.pdf");
setContentView(webview);
PluginsEnabled replaced
webView.getSettings().setPluginState(WebSettings.PluginState.ON);
not work in any way help!
WebView cannot display PDF documents in Android.
You can handle the pdf to either download it and then open a 3rd party app as shown here.
Or you can also use Google Drive viewer.
String myPdfUrl = "http://example.com/awesome.pdf";
String url = "http://docs.google.com/gview?embedded=true&url=" + myPdfUrl;
Log.i(TAG, "Opening PDF: " + url);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);

How to extract text from html page?

How to extract text from html page? For example the web page is the link http://www.atempodihockey.it/campionati/campionati-hil/serie-a1-2013-2014/calendario.html from I want to take the text. I must have the name of the team and the resoult of the match
I think below code can help u
webView = (WebView) findViewById(R.id.webterms);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginsEnabled(true);
webView.getSettings()
.setUserAgentString(
"Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
after creating your webview load your url or html page
webView.addJavascriptInterface(new MyJavaScriptInterface(),"HTMLOUT");
webView.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
#Override
public void onPageFinished(WebView view, String url1) {
if (pDialog.isShowing()) {
pDialog.dismiss();
}
webView.loadUrl("javascript:window.HTMLOUT.processHTML(document.documentElement.innerText);");
}
});
webView.loadUrl(url);
Then create a class which has a one method for processing your html
class MyJavaScriptInterface {
public void processHTML(String html) {
if (null != html && html.trim().length() > 0) {
System.out.println("your Html ->" + html);
}
}
For this purpose, you can use HtmlAgilityPack
Do it as follwing...
Add reference of HtmlAgilityPack in your project.
using HtmlAgilityPack;
and then put the url to get the full page
HtmlWeb webGet = new HtmlWeb();
HtmlDocument document = webGet.Load("http://www.atempodihockey.it/campionati/campionati-hil/serie-a1-2013-2014/calendario.html");
From the html of 'document' variable you can get your expected text

Categories

Resources