android-webview

WebView addJavascriptInterface function with Parameters

穿精又带淫゛_ 提交于 2019-12-19 10:53:02
问题 I have added a JavaScript Interface to WebView. I am able to use all the Functions which has no Parameters. But When i gave the Parameter from JavaScript. The function are not called by WebView. See Code Javascript function getCellString(row, column) { return Report.getCellString(row,column); } WebView webView.addJavascriptInterface(new JavaScriptInterface(), "Report"); Javascript Interface public class JavaScriptInterface { public String getCellString(int row, int column) { return row + ","

How to open desktop site in webview in android

家住魔仙堡 提交于 2019-12-19 10:25:18
问题 I need to open desktop site in android webview for that i have tried as below but it is not working. String newUA= "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0"; mWebView.getSettings().setUserAgentString(newUA); 回答1: This is the perfect solution: private static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"; private static final String MOBILE_USER_AGENT = "Mozilla/5

JavaScript doesn't work on ICS

廉价感情. 提交于 2019-12-19 10:22:04
问题 I am working on EPUB reader for the company using JavaScript, the application runs well on Android 2.2, but when i try it on ICS & HoneyCom, the JavaScript doesn't work well. The first problem i faced, the WebView doesn't load JS files ( Unknown Error -6 ), so i used this solution: @TargetApi(11) @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { Log.d("shouldInterceptRequest", url); InputStream stream = inputStreamForAndroidResource(url); if (stream !=

Listview with webview

≡放荡痞女 提交于 2019-12-19 10:04:04
问题 i'm trying to create a ListView with a Webview inside, but the app shows nothing. Here my Code: The MainActivity where I set the CustomAdapter public class Web_in_list1Activity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView lv = (ListView)findViewById(R.id.listView2); ListViewAdapter adapter = new ListViewAdapter(this); lv.setAdapter

Listview with webview

社会主义新天地 提交于 2019-12-19 10:03:50
问题 i'm trying to create a ListView with a Webview inside, but the app shows nothing. Here my Code: The MainActivity where I set the CustomAdapter public class Web_in_list1Activity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView lv = (ListView)findViewById(R.id.listView2); ListViewAdapter adapter = new ListViewAdapter(this); lv.setAdapter

WebView in Android 4.4 and initial-scale

本秂侑毒 提交于 2019-12-19 09:51:58
问题 I've been banging my head against the wall for the whole day now, and i need some help :( The problem is, that i have a WebApp that was designed for 640x960 . We didn't have time to write css for each screen size, so i've used initial-scale, maximum-scale, minimum-scale in the viewport meta tag to scale the app to different screen sizes. The problem is, that in Android 4.4 , no matter what i do, it always scales the app up, but never down! I mean if i use a value of 0.7 , the app is scaled up

Using local storage on Android webview

风流意气都作罢 提交于 2019-12-19 09:46:08
问题 I am experimenting with Android code: I would like to store one value using HTML 5 local storage. For this exercise I' using a page as simple as this one: http://www.w3schools.com/html5/tryit.asp?filename=tryhtml5_webstorage_local_clickcount My manifest does allow me to hit the internet, and it is min-sdk of 7. Here is my java code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview = (WebView) findViewById(R.id.webview

Android WebView: Handle arrow keys in JavaScript

非 Y 不嫁゛ 提交于 2019-12-19 08:56:21
问题 I have a simple WebView application which I want to control with the keyboard. Is it possible to catch arrow keys in Javascript? I have tried the following code without any luck: function handleArrowKeys(evt) { console.info('key'); } document.onkeyup = handleArrowKeys; document.onkedown = handleArrowKeys; document.onkepress = handleArrowKeys; Javascript is enabled in the webview WebSettings webSettings = webview.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings

How to hide keyboard when user clicks on textbox in webview android

拥有回忆 提交于 2019-12-19 08:15:14
问题 Can we hide android system keyboard when user focuses or clicks on html input elements inside the webview. I have tried hiding keyboard on user touches webview: webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch (View v, MotionEvent event){ Toast.makeText(cx,"Web View Touch",Toast.LENGTH_LONG).show(); v.onTouchEvent(event); InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm

How to read the data in a Blob in WebView on Android?

最后都变了- 提交于 2019-12-19 07:48:11
问题 I have a server that creates an object blob on the browser and I want to download this within WebView in an Android app. I tried redirecting the request to the browser instance as well as using the download manager to do this, but neither of them seems to work (Even though if I open up the same page in Chrome, the download operation works there). I tried the following code,it throws error: Android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent