FAQ Database Discussion Community


Jquery functionalities are not working when i load the html data from a string into webview

android,jquery,html,jquery-mobile,android-webview
I'm developing an application in which webview loads the html data which is coming as string from the server.Actually showing that html string in webview is working fine but taking long time if there are any images in that data.So,I think of lazy loader will be good in this case....

How do I refresh the contents of a webview everytime the app is launched?

android,webview,android-webview,android-websettings,android-webservice
I am trying to refresh the contents of my webview everytime someone launches my app.Say someone goes to a different page within the app or goes to background and then relaunches the app, i want the contents of my webview to refresh/reload based on the latest changes I have done...

Control what JS is executed in an Android WebView

javascript,android,android-webview
Is it possible to control which JS is executed in an Android WebView on a fine-grained level? As far as I can tell it is only possible to enable/disable JS in the WebView globally and add JS Interfaces. But what about blocking just certain APIs in a WebView? Is this...

how to get current activity of the webview in android

android,android-activity,webview,android-webview
I'm using Webview in my app , i have a simple website, it has two buttons such as Female and Male , if user click that button i want to show the toast message using android app to users which button they clicked This is my Webview content I wanted...

WebView Is not behaving like Chrome

android,google-chrome,android-webview
I'm trying to open a TripAdvisor URL in my web view, so the users can easily rate my client Hotel. So what I did was to open the TripAdvisor web site in the Phone Chrome App copied the URL and then use it in the web view loadUrl method. But...

Multiple clickable link in textview

android,html,textview,android-webview,android-toast
I want to set html text in textview like this: <a href="?id=1>Toast id1</a>hello there <a href="?id=2>Toast id2</a> hello there <a href="?id=3> Toast id3</a> I want to show the different toast after clicking on different link with different id(query string)....

Android WebView in a ViewSwitcher loadUrl loads once

android-webview,android-adapter
I have in my ViewSwitcher a ListView and a WebView. In my ListView's adapter, I have an onclick listener that writes the clicked url in the list to sharedpreferences. I'm trying to load that url into the WebView using an onSharedPreferencesChangedListener. This is the code in my adapter: convertView.setOnClickListener(new View.OnClickListener()...

Web View doesn't load when url is changed internally

android,url,android-webview
I am using webview as normal way like WebView webView = (WebView) findViewById(R.id.webView1); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("http://www.google.com"); webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(WebViewActivity.this, description, Toast.LENGTH_SHORT).show(); } }); Now when I search...

Page redirection for mailto and tel links on Android

android,cordova,android-webview,mailto,tel
I have a working Cordova iOS app. Now I am working on an Android app. I have a "contact us" page where I have a link: <a id="lnkEmail" style="border: none;box-shadow: none;text-align: left;" data-role="button" href="#"> [email protected] </a> $('#lnkEmail').on('click',function(){ document.location.href = "mailto:[email protected]"; }); The page is redirected to a "webpage not available"...

Andriod WebView Exception

android,webview,android-webview
I am using WebView in android. When I click one of the three buttons, it renders a related website in the rest of the screen. When I click the first button, it works well (picture 1)(http://www.baidu.com). But when I click the rest of two, it pops out a hint...

Android WebView doesn't show image

android,html,android-webview
I have an html file locally with local images. I'm trying to display it using webView.loadDataWithBaseURL(contentPath, content, "text/html", "UTF-8", null); where contentPath is the file path and the content is the actual html. It is showing the html fine but the problem is I have images inside it that don't...

Images not loading in android webview

android,android-webview
I am trying to load the site in an android app web view. The site loads without the images ,all the images from the site are not loaded what could be the problem. The code for onCreate is shown below. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); String url =...

Sample WebView application source code Android

javascript,android,html5,android-webview,android-websettings
I'm working on an HTML5 based Android App, and I don't understand how to get WebView working. I was wondering if anyone could point me to a place where I can download the source code for an example application of this so I can modify it for my app, or...

Does webview create a separate surface like videoview does?

android,android-webview,android-videoview
I have a confusion and look forward to some comments on this. I was assuming that WebView creates a separate surface to draw and does not use the default surface of the activity to draw. But, in surfaceflinger dump, I dont see a new surface getting created when using webview....

How to stop Activity from reloading when using Intent.createChooser() to launch a sharing menu?

android,android-intent,android-webview,android-sharing
I have a WebView which has an sharing icon at the bottom of the page. When the user presses the icon, it launches a sharing menu: chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Share via"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{})); startActivityForResult(chooserIntent, SHARING_MENU); After the sharing menu pops up, if the user presses Back button or clicks...

Android: Back button causing WebView to look for wrong asset

android,webview,android-webview
In my Android app, I start a new Activity by overriding the URL loading of a WebView that loads a local html file from assets. When I click the back button on the Android device to get back to the Activity with the WebView, the WebView now displays the message...

Making an embed video full screen in android webview

android,html5,android-webview,html5-video,fullscreen
I want to take an embedded video from a website and then play it full screen, like the default android browser does. I have been looking all over trying to find the solution but I am coming up short. I have the video playing fine, but I want it to...

Does Android Webview timeout iframe objects?

android,html,iframe,android-webview
I have an app with a webpage called Avebury.html, and this has some javascript created by a colleague which loads a second HTML file inside it called widget. This has an iframe containing an embedded google map. Both are in the assets folder. The problem is when trying to load...

Overwriting WebView with progress change of SeekBar

java,android,android-webview,android-seekbar
I created a WebView which loads google.com as test. And at the bottom of the Layout ist a SeekBar. If the Seekbar is changed to progress of 2 it shall for example load another page like stackoverflow.com. If its progress is changed to 3,it shall load another page ( android.com)...

Workaround for file uploads on Android 4.4 using reflection

android,android-webview,webchromeclient
From Android 4.1 to Android 4.3, you could subclass WebChromeClient on Android and implement the following (hidden, thus no @Override) method: public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { ... } You would open a file picker in that method, and when your Activity receives the result in onActivityResult(...),...

How to Parse Jsoup data in Fragment (WebView)

android,android-fragments,android-webview,jsoup
Here's my fragment.There's no error or something but still a blank screen when i open up the fragment. How can i solved this Thread thing ? I just want parsing from html and show in WebView. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootview = inflater.inflate(R.layout.menu2_layout_duyurular, container,...

Accessing Android Content Provider inside Webview

html5,android-webview,android-sqlite,android-contentprovider
In Android. How do you access Content Provider inside your webview. It is showing content uri as not defined google.visualization.Query(CONTENT_URI, opt_options); ...

LinkedIn Rest API, State token doesn't match

android,android-webview,token,linkedin,state
I am referring this to authorize, authenticate and login to LinkedIn account using Rest API, but now i am facing problem, the WebView where i am displaying the LinkedIn Rest API call url view, is returning blank with message as "State token doesn't match" It was working fine earlier, but...

Video access with android AdvancedWebView

android,webview,android-webview
Is there a way to give my android app camera access permission with AdvancedWebView? It is possible with native webview, but the native do not allow file upload through < input type="file" >, so now I have the file upload working, but no camera. Main code: public class MainActivity extends...

Android WebView: Page garbled after element removal

javascript,android,android-webview
I'm developing Android WebView for a website. After I entered 10-12 lines of element removals in loadUrl method, page looks garbled. Is there a specific sequence of element removals or modifications? Here's my code: MyWebViewClient webViewClient = new MyWebViewClient(); webView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) {...

get value of webWiev.getUrl() in WebResourceResponse shouldInterceptRequest(WebView view, String url)

android,webview,android-webview
I have function like this: public WebResourceResponse shouldInterceptRequest(WebView view, String url) { if (url.contains("images/srpr/logo11w.png")){ return new WebResourceResponse("text/plain", "utf-8", new ByteArrayInputStream("".getBytes())); } return super.shouldInterceptRequest(view, url); } And it is working, fine. I want to add one check by current webView url and intercept request only if its on specific page. And...

Attempt to write a readonly database… but I'm not

android,sqlite,android-webview
I have a read-only database connection. Sometimes, when reading data from the database with a SELECT query, it throws a SQLiteReadOnlyDatabaseException. I open the connection like this: return SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY); The query is: Select * FROM BudgetVersions WHERE entityId = ? I read data from the database using db.rawQuery(),...

google map auto filling is not working in android webview

android,android-activity,webview,android-webview
i'm using webview concept in android. in web page i'm using a address auto fill. it is working in browser , but when i make that website into webview that auto filling is not working . setContentView(R.layout.activity_main); myWebView = (WebView) findViewById(R.id.webView1); myWebView.getSettings().setSupportZoom(true); myWebView.getSettings().setBuiltInZoomControls(true); myWebView.loadUrl("www.vacationgod.com/taxi"); this is mainactivity.java ...

Android Stock Browser - Not responding to class changes

javascript,android,css,browser,android-webview
For my web-page, things work fine on Android API level 21. But when I test the same page against Android API level 18, some features do not work. When I toggle class "check" on .div1 with javascript. The .div2 display is not updated. Here is sample HTML and sample CSS...

Android WebView rendered incorrectly on LG G2

android,android-webview
I am writing an app for our client in which I must show a WebView to the user which is a web site supplied by the client in which I inject JS in order to hide certain desktop-only elements. I initially ran into a problem on KitKat while attempting to...

findViewById returns null for WebView in android studio 1.1

java,android,android-webview
I build one android app which consists of one webview. I use Android studio 1.1. The minimal SDK is 19. Only one layout, activity_main.xml in the following code <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin"...

What have I done wrong to make my app run at startup?

java,android,android-webview
I am just trying to make my webview app run upon the bootup of an android device. I already followed every single step mentioned in this post however it does not run on device boot up. What am I missing here? public class BootUpReceiver extends BroadcastReceiver { @Override public void...

How can I control android webview activity changes when I change screen orientation?

java,android,android-studio,android-webview,screen-orientation
import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Bitmap; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener; import android.support.v7.app.ActionBar; import...

Scroll to HTML content in WebView

android,android-webview
Is there a way to programmatically scroll to a HTML element that is displayed in a WebView? The WebView API only provides a scrollTo(x,y) method, but I can't find a way to determine the position of a displayed element. Solution Using Javascript: webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("javascript:document.getElementById('id').scrollIntoView();"); ...

Webview Showing error message while tried to load with Line chart report data: SYNTAX_ERR: Dom Exception 12

android,android-webview,android-4.0,linechart
I've implemented google charts for generating Line Chart reports. It works fine in above ICS Devices. But in ICS web view is loading with an error message instead of expected line chart report. In what case can web view shows this error on web page The error message is: SYNTAX_ERR:...

Android WebView : how do I control webView height?

android,html,css3,webview,android-webview
I am developping an android apps and I want to comunicate with the users giving them some informations as admob ads. I want to use "WebView" and to fix its height to "50dp". How do i fix the height from the server (html fille or css) to fit exactly the...

Which consumes less memory a Webview or a listview?

android,android-listview,android-webview
Please see the picture. I have an application that shows data in the form of list but it is a WebView.My application size got increased and it is also creating a lot of data. So if i convert all the webview to list view then will it reduce the size...

Can we know when browser finish loading an URL from application on Android

android,browser,android-webview
I Have an app, and from app I use this code to open URL in browser of android. button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.mkyong.com")); startActivity(intent); } }); And i want to know if we can know when browser complete loading that...

Having difficulty controlling webview from other activities/classes

java,android,android-webview,android-adapter,recyclerview
As it stands right now, In my app I am writing, I have a navigation drawer via NavigationDrawerFragment with a RecyclerView populated via an adapter in another class, and a WebView in my MainActivity. I'm at a point where I've got click handling from my RecyclerView's adapter and what I...

WebView return null pointer exception

android,nullpointerexception,android-webview
I have a problem with webview in android. this is the code of the class webview: public class WebViewsActivity extends Activity { private WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.web_views); Intent thisIntent = getIntent(); final String link = thisIntent.getExtras().getString("link"); Log.e("link is :",link); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(link); } } and...

Best way to create a header and footer for webview in Android

android,android-webview,android-4.0,android-scrollview
I want to create news like activity that has title and date and some share and favorite buttons in the beginning at the top, the article text (and maybe some images and headers titles) is in html that I get from server, and at the end a list of related...

Force to close the app if there's no internet connection in webview

android,android-webview
Using an Android WebView, how can I force the application to close if the phone has no internet connection? Alternatively, if this is not possible, is there any way to show a 404 html page if user is offline. Here's my code: public class MainActivity extends Activity { private WebView...

Android show MDWiki in WebView

android,android-webview,markdown
I need to open an MDWiki with a WebView. So i load the index.html from the android_asset. First error was that he didn't find config.json file. I created this myself. Then i had an error for favicon.png. I use a normal picture for this now. But he still don't load...

Backspace and undo button not working

android,android-studio,webview,android-webview
I have attempted to make the enter button put a url into the webview using the following code, but once enter is pressed, both the undo and backspace button do not do anything anymore. Help? editText.setOnKeyListener(new View.OnKeyListener() { //inner class public boolean onKey(View v, int keyCode, KeyEvent event) { //identifies...

How to Transfer unknown data array to webview using json in android

javascript,android,json,arraylist,android-webview
I am getting a array from cursor, I want to pass the array to webview for display as chart. I don't have any experience in Json can you help. For Conversion to Json @JavascriptInterface public JSONArray getNum11() { JSONArray myArray = new JSONArray(Arrays.asList(mArrayList)); return myArray; } Reconversion to Array var...

Android WebView: ProgressBar not showing (Used Google's tutorial)

android,android-webview
Progress bar doesn't show when a web page loads in WebView. My XML code snippet: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"...

Supporting WebGL on Android 5's WebView

java,android,google-chrome,android-webview,webgl
I have a web project (depends on WebGL) which works on computers, any browser. Now I am trying this project to be opened as an application on Android based mobile phones. I used WebView to accomplish this. My phone (Nexus 3) had Android 4.3 and as I learnt afterwards before...

save webpages to webview cache in android

android,android-webview
I'm creating an app which will download some webpages from internet and save them to cache when user clicks on a button and load them later when no internet is available. when I run my code I get null pointer exception. I have added all the necessary permissions in the...

Android Webview: console is not defined

javascript,android,webview,android-webview
I'm trying to open a html with some javascripts in a Android Webview and getting the following error after implements onConsoleMessage of my WebChromeClient: Uncaught ReferenceError: console is not defined -- From line 10 of file:///storage/sdcard0/TargetApp/e184bae3-5824-4e23-a26e-820ce6d32aa2/pres/fce4da510de8431bB3eeD5bdbd1c695d/fce4da510de8431bB3eeD5bdbd1c695d/html/js/target/util_Q_3bb82a6eabd3339d91ca15cb4fd6685c.js Follows the line 10 of my file: console = console ? console : {...

unable to clear login information in Webview

android,android-webview,webviewclient
I recently logged into Microsoft WAAD account using an webview, on further opening of the app again for testing i do not see the login page of Microsoft however i would be taken to next page after login directly. i tried these things: webView.clearCache(true); webView.clearFormData(); webView.clearHistory(); webView.clearSslPreferences(); getApplicationContext().deleteDatabase("webview.db"); getApplicationContext().deleteDatabase("webviewCache.db"); getBaseContext().deleteDatabase("webview.db");...

Refused to display a frame because it set X-Frame-Options to 'DENY in android webview

javascript,android,html,webview,android-webview
When I try to show the google calendar in webview , it show some error: [INFO:CONSOLE(0)] "Refused to display 'https://accounts.google.com/ServiceLogin?service=cl&passive=1209600&continue=https://www.google.com/calendar/embed?src%[email protected]%26ctz%3DAsia/Hong_Kong&followup=https://www.google.com/calendar/embed?src%[email protected]%26ctz%3DAsia/Hong_Kong&btmpl=mobile&ltmpl=mobilex&scc=1' in a frame because it set 'X-Frame-Options' to 'DENY'.", source: about:blank (0) And this is the html code...

Open rss item in webview

android,rss,android-webview,rss-reader
I'm making android rss reader app that get rss ,parse then show items in listView Now with my code when item clicked it opens the default browser show rss I want to show that in another activity in webview So how can I do it? Here is my code public...

Start an Activity based on parameter passed from JavaScript interface

android,android-activity,android-webview
I want to open a new activity when I tap on a link in my WebView, but I don't know how to create a method passing an Object variable to make a dynamic method. That's why I do it this way actually: public class WebAppInterface { public Context mContext; WebAppInterface(Context...

Android WebView density issue

android,twitter-bootstrap,width,android-webview,pixel
Got some problems with the WebView class. I've got a WebView inside a RelativeLayout. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webViewFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFF00" android:orientation="vertical" > <WebView android:id="@+id/mWebView" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true"...

Fatal Exception: java.lang.NullPointerException at MainFragment

android,android-webview,android-assets
recently I found out that my application crashes on some devices. Here is the crash: java.lang.NullPointerException at com.zippyshare.search.free.fragment.MainFragment$3.loadFromAssetsWhite(MainFragment.java:501) at com.zippyshare.search.free.fragment.MainFragment$3.shouldInterceptRequest(MainFragment.java:477) at android.webkit.CallbackProxy.shouldInterceptRequest(CallbackProxy.java:1463) at android.webkit.BrowserFrame.shouldInterceptRequest(BrowserFrame.java:964) at...