webviewclient

Upload camera photo and filechooser from webview INPUT field

a 夏天 提交于 2019-11-30 04:05:47
My app is webbased and I need to upload pictures from an INPUT field camp. I've two situations and as i don't know another way to do it depending the page I'm choosing one or another with "boolean boolFileChoser" depending its URL petition: a. file picker b. camera photo shoot. I've dealt with file picker and it upload the file perfectly, the problem is with the camera. Once i try to upload the Camera Pic, it crashes. As far as i know its because the URI. a) File picker: content://media/external/images/1234 b) Camera shoot: file:///mnt/sdcard/Pic.jpg I've found no way to change it. See update

Android JS in WebView.loadUrl()

对着背影说爱祢 提交于 2019-11-30 04:03:42
I want to load a webpage in WebView but remove parts of the webpage. So, I created a custom WebViewClient. And, in onPageFinished(), I did some javascript to remove some elements. Then, I made the WebView visible. However, when I run it, it sets the view visible, and then I see the elements being removed. It is as if the JS is running in the background very slowly. It creates a poor viewing experience because it flashes the full page and then the desired partial page. Here is my onPageFinished() @Override public void onPageFinished(WebView view, String url) { view.loadUrl("javascript:" +

Android WebView ignoring target=“_blank” when added WebViewClient

只愿长相守 提交于 2019-11-29 19:45:38
问题 I am facing a strange issue. In my application, I need to load a static html file based on clicked button in a WebView from assets folder. Now among 5 html files, one html file contains 15 static links. These links need to redirect user to the mentioned url in a mobile browser. I have used target="_blank" for that purpose as follows in my html file. <div class="lid"><a href="https://www.irctc.co.in/" target="_blank">Railway Reservation </a></div> Now, this works fine in a sample application

load WebView cached image into an ImageView

▼魔方 西西 提交于 2019-11-29 10:45:36
I have a WebView that caches its images into a directory using these settings: mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); mWebView.getSettings().setAppCacheMaxSize( 8 * 1024 * 1024 ); // 8MB mWebView.getSettings().setAppCachePath(getApplicationContext().getCacheDir().getAbsolutePath()); mWebView.getSettings().setAllowFileAccess(true); mWebView.getSettings().setAppCacheEnabled(true); I want to be able to load an image that is cached using this WebView into an ImageView. I was looking into the directory where the cache dir points to using adb shell (/data/data/com

Android - Load PDF inside webview

家住魔仙堡 提交于 2019-11-29 04:15:03
问题 I have this webview code and I want to make it possible to have the PDF files opened when a user clicks on a PDF link. Here is the code, can you tell me what I have to put inside the PDF area of this? I've tried many different ways and I cannot get the PDF to view at all. Thanks for the help. webview.setWebViewClient ( new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { // do your handling codes here, which url is the requested url // probably you need to

How to get link-URL in Android WebView with HitTestResult for a linked image (and not the image-URL) with Longclick

不想你离开。 提交于 2019-11-28 23:59:35
I try to catch webview longclicks to show a context menu. (see code below) When longclicking an image, I always get the image-URL as extra (for a not linked image with IMAGE_TYPE and for a linked image with SRC_IMAGE_ANCHOR_TYPE). But how can I get the Link-URL (and not the image-URL) for an image with a hyperlink? Best, Sebastian mywebview.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(View v) { final WebView webview = (WebView) v; final WebView.HitTestResult result = webview.getHitTestResult(); if (result.getType() == SRC_ANCHOR_TYPE) { return true; } if

WebView loadUrl works only once

泪湿孤枕 提交于 2019-11-28 19:19:43
EDIT: I worked on this project years ago and unfortunately I cannot verify if any of the answers is working in the given scenario. I am having hard time with one WebView which should show our blog. When initilized, it works just fine. The user can navigate to different links within the WebView. To get back to the blog, there is a button outside the WebView which should load the main blog site again. The problem is, that nothing is loaded after the second call to loadUrl. Here is my code: private WebView wv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

How do I use DownloadListener?

大憨熊 提交于 2019-11-28 11:31:28
I am creating an app that allows college students to download their study material from within the app instead of the browser. The home page has lots of subject names. Each subject name leads to new webpage. So, I have used WebViewClient . But, at the final page when I click on the *.ppt or *.pdf files it opens junk. I want these files to be downloaded within the app. How do I implement DownloadListener package jiit.app; import android.app.Activity; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; public class sm

how to set different title for alert dialog when WebView page is loaded?

我们两清 提交于 2019-11-28 08:13:59
问题 I want to set different title for alert dialog when WebView page is loaded but its not working. here is the code snippet: final AlertDialog.Builder alert = new AlertDialog.Builder( mContext); // alert.setTitle("Loading..."); final WebView wv = new WebView(mContext); wv.loadUrl("http://10.0.51.133/androidview/"); wv.getSettings().setJavaScriptEnabled(true); wv.setVerticalScrollBarEnabled(false); WebViewClientLoader loader= new WebViewClientLoader(alert); wv.setWebViewClient(loader); wv

load WebView cached image into an ImageView

拈花ヽ惹草 提交于 2019-11-28 04:03:03
问题 I have a WebView that caches its images into a directory using these settings: mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); mWebView.getSettings().setAppCacheMaxSize( 8 * 1024 * 1024 ); // 8MB mWebView.getSettings().setAppCachePath(getApplicationContext().getCacheDir().getAbsolutePath()); mWebView.getSettings().setAllowFileAccess(true); mWebView.getSettings().setAppCacheEnabled(true); I want to be able to load an image that is cached using this WebView into an