Search Results

Search found 26 results on 2 pages for 'webviewclient'.

Page 1/2 | 1 2  | Next Page >

  • Android Phonegap - TIMEOUT ERROR when trying to set a WebViewClient

    - by Spike777
    I'm working with Android and Phonegap, and at the moment I'm having trouble with one simple thing. I need to setup a webViewClient to the PhoneGap webView in order to capture the URL of a page finished and to work with that. This is the code: public class PhoneGapTest extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setBooleanProperty("loadInWebView", true); super.clearCache(); super.keepRunning = false; super.loadUrl("file:///android_asset/www/index.html"); super.appView.setWebViewClient(new WebViewClient(){ @Override public void onPageStarted(WebView view, String url, Bitmap bitmap) { Log.i("TEST", "onPageStarted: " + url); } @Override public void onPageFinished(WebView view, String url) { Log.i("TEST", "onPageFinished: " + url); } }); } That code doesn't seems to work, the page never loads and I get a TIMEOUT ERROR, but if I remove the "setWebViewClient" part the page loads perfectly. I saw that there is a class CordovaWebViewClient, do I have to use that instead of WebViewClient? I found this way on the web: this.appView.setWebViewClient(new CordovaWebViewClient(this){ @Override public boolean shouldOverrideUrlLoading(final WebView view, String url) { Log.i("BugTest", "shouldOverrideUrlLoading: " + url); return true; } @Override public void onPageStarted(WebView view, String url, Bitmap bitmap) { Log.i("TEST", "onPageStarted: " + url); } @Override public void onPageFinished(WebView view, String url) { Log.i("TEST", "onPageFinished: " + url); } @Override public void doUpdateVisitedHistory(WebView view, String url, boolean isReload){ } }); But that code isn't working either, I still got a TIMEOUT ERROR. I also saw that there is already a webVieClient member, but I don't if I have to use it and how. I'm working with Phonegap version 1.9.0 Thanks for reading Answer to Simon: This doesn't work either, I still receive a TIMEOUT ERROR, there is something wrong? public class MainActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); super.appView.clearCache(true); super.appView.clearHistory(); this.appView.setWebViewClient(new CustomCordovaWebViewClient(this)); super.loadUrl("file:///android_asset/www/index.html"); } public class CustomCordovaWebViewClient extends CordovaWebViewClient { public CustomCordovaWebViewClient(DroidGap ctx) { super(ctx); } @Override public void onPageStarted(WebView view, String url, Bitmap bitmap) { Log.i("TEST", "onPageStarted: " + url); } @Override public void onPageFinished(WebView view, String url) { Log.i("TEST", "onPageFinished: " + url); } @Override public void doUpdateVisitedHistory(WebView view, String url, boolean isReload){ } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { } } }

    Read the article

  • Android WebViewClient problem

    - by deSelby
    I've defined a private class that extends WebViewClient and set my WebView's client to an instance of that class (webView01.setWebViewClient(new Callback());). The class definition is as follows: private class Callback extends WebViewClient { public void onLoadResource (WebView view, String url) { } public void onPageStarted (WebView view, String url, Bitmap favicon) { } public void onPageFinished (WebView view, String url) { Animation anim = AnimationUtils.loadAnimation(MyNews.this, R.anim.webviewanim); view.startAnimation(anim); } public void onReceivedError (WebView view, int errorCode, String description, String failingUrl) { } public boolean shouldOverrideUrlLoading (WebView view, String url) { Log.e("loading url", url); return false; } } My problem is that onPageFinished is definitely getting called, but shouldOverrideUrlLoading is never being called. What am I doing wrong here?

    Read the article

  • Using HTTPPOST with WebViewClient

    - by miannelle
    I am looking for an example of using a WebViewClient with shouldOverrideUrlLoading and using HttpPost. I need to display a web page, keep it within my layout boundaries so it can not launch a new browser and also use HttpPost to send data to the host.

    Read the article

  • Android webview doesn't playing mp4 video in same page

    - by user1668105
    I'm trying to show one local html file contains code for playing video and try to show that html file in android webview. I've used following code to for playing video: WebViewLoadVideoActivity.java //DECLARE webview variable outside of onCreate function so we can access it in other functions (menu) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView webView = (WebView) findViewById(R.id.webView1); WebSettings webSettings = webView.getSettings(); // Fetches the // WebSettings // import WebViewClient webViewClient = new WebViewClient(); webView.setWebViewClient(webViewClient); // Enabling mp4 webSettings.setPluginsEnabled(true); // Allows plugins to run which are // normally disabled in webView webView.getSettings().setBuiltInZoomControls(true); // Allows the // Android built in // zoom control webView.getSettings().setSaveFormData(true); webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setPluginsEnabled(true); webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setSupportMultipleWindows(true); webView.getSettings().setPluginsEnabled(true); webView.getSettings().setLightTouchEnabled(true); webView.getSettings().setAllowFileAccess(true); // To allow file // downloads/streams // such as mp4, mpeg, // and 3gp files webView.getSettings().setJavaScriptEnabled(true); // Enables HTML // Javascript to run // in webview webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webView.getSettings().setSupportZoom(true); // Support the zoom feature webView.getSettings().setSavePassword(true); // Allow users to save passwords in forms webView.setWebViewClient(new WebViewClient() { // Opens web links clicked by user in the webview @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Handle the error } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); webView.loadUrl("file:///android_asset/test.html"); // test.html file from assets folder //... Rest of activity code... test.html <!DOCTYPE html> <html> <body> <video width="320" height="240" controls="controls"> <source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4" /> Your browser does not support the video tag. </video> </body> </html> Problem Area : Android webview or Android Default Browser shows the video content in another video view when we click play button, My requirement is that video should be opened in same html page inline, so user can navigate to other page of webpage during video is playing or buffering. Research Area : I tried many other ways like, video tag of HTML5 embed tag of HTML object tag of HTML Other way of video player integration i checked so far but not worked in my requirement, Flare Video jplayer Please suggest me any way that can be suitable for my requirement, And my requirement is very simple as, I want to play video in html file as inline in webview widget of android. Thanks in Advance.

    Read the article

  • Android WebView not loading a JavaScript file, but Android Browser loads it fine.

    - by Justin
    I'm writing an application which connects to a back office site. The backoffice site contains a whole slew of JavaScript functions, at least 100 times the average site. Unfortunately it does not load them, and causes much of the functionality to not work properly. So I am running a test. I put a page out on my server which loads the FireBugLite javascript text. Its a lot of javascript and perfect to test and see if the Android WebView will load it. The WebView loads nothing, but the browser loads the Firebug Icon. What on earth would make the difference, why can it run in the browser and not in my WebView? Any suggestions. More background information, in order to get the stinking backoffice application available on a Droid (or any other platform except windows) I needed to trick the bakcoffice application to believe what's accessing the website is Internet Explorer. I do this by modifying the WebView User Agent. Also for this application I've slimmed my landing page, so I could give you the source to offer me aid. package ksc.myKMB; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.graphics.Bitmap; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.Window; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebSettings; import android.webkit.WebViewClient; import android.widget.Toast; public class myKMB extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /** Performs base set up */ /** Create a Activity of this Activity, IE myProcess */ myProcess = this; /*** Create global objects and web browsing objects */ HideDialogOnce = true; webview = new WebView(this) { }; webChromeClient = new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { // Activities and WebViews measure progress with different scales. // The progress meter will automatically disappear when we reach 100% myProcess.setProgress((progress * 100)); //CreateMessage("Progress is : " + progress); } }; webViewClient = new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(myProcess, MessageBegText + description + MessageEndText, Toast.LENGTH_SHORT).show(); } public void onPageFinished (WebView view, String url) { /** Hide dialog */ try { // loadingDialog.dismiss(); } finally { } //myProcess.setProgress(1000); /** Fon't show the dialog while I'm performing fixes */ //HideDialogOnce = true; view.loadUrl("javascript:document.getElementById('JTRANS011').style.visibility='visible';"); } public void onPageStarted(WebView view, String url, Bitmap favicon) { if (HideDialogOnce == false) { //loadingDialog = ProgressDialog.show(myProcess, "", // "One moment, the page is laoding...", true); } else { //HideDialogOnce = true; } } }; getWindow().requestFeature(Window.FEATURE_PROGRESS); webview.setWebChromeClient(webChromeClient); webview.setWebViewClient(webViewClient); setContentView(webview); /** Load the Keynote Browser Settings */ LoadSettings(); webview.loadUrl(LandingPage); } /** Get Menu */ @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; } /** an item gets pushed */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // We have only one menu option case R.id.quit: System.exit(0); break; case R.id.back: webview.goBack(); case R.id.refresh: webview.reload(); case R.id.info: //IncludeJavascript(""); } return true; } /** Begin Globals */ public WebView webview; public WebChromeClient webChromeClient; public WebViewClient webViewClient; public ProgressDialog loadingDialog; public Boolean HideDialogOnce; public Activity myProcess; public String OverideUserAgent_IE = "Mozilla/5.0 (Windows; MSIE 6.0; Android 1.6; en-US) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Safari/523.12.2 myKMB/1.0"; public String LandingPage = "http://kscserver.com/main-leap-slim.html"; public String MessageBegText = "Problem making a connection, Details: "; public String MessageEndText = " For Support Call: (xxx) xxx - xxxx."; public void LoadSettings() { webview.getSettings().setUserAgentString(OverideUserAgent_IE); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setSupportZoom(true); } /** Creates a message alert dialog */ public void CreateMessage(String message) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(message) .setCancelable(true) .setNegativeButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } } My Application is running in the background, and as you can see no Firebug in the lower right hand corner. However the browser (the emulator on top) has the same page but shows the firebug. What am I doing wrong? I'm assuming its either not enough memory allocated to the application, process power allocation, or a physical memory thing. I can't tell, all I know is the results are strange. I get the same thing form my android device, the application shows no firebug but the browser shows the firebug.

    Read the article

  • How to control a webView

    - by klaus-vlad
    Hi, In one of my xml layouts I use an webview (besides other TextViews) for which I call loadUrl("myURL") to display the content from a url. The desired effect is to have displayed in a screen all the other textViews , and below them the content of web page. However when the webview loads the URL , it starts a new activity and displays the content in that activity, which is not what I need. Any ideas on how I could force the described behavior ? Later edit: I have succeed to have layout with several views mixed, one of them being the webview .Also I have succeed to obtain the described above behavior. But only after I setted a WebView client with setWebViewClient(WebViewClient); . Now I'd like to know why does it work like this only after a webViewClient is set ?

    Read the article

  • Calling javascript function from android webview?

    - by Edmond Tamas
    I try to call a javascript function from directly form my application (webview.apk), in order to start a script which would autoplay a html5 video clip, I have tried to add itt right after webview loadURL but wwithout luck. Maybe someone could take a look at the code. What am I missing? Thanks! package tscolari.mobile_sample; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.webkit.WebChromeClient; import android.media.MediaPlayer; public class InfoSpotActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView mainWebView = (WebView) findViewById(R.id.mainWebView); WebSettings webSettings = mainWebView.getSettings(); webSettings.setJavaScriptEnabled(true); mainWebView.setWebChromeClient(new WebChromeClient()); mainWebView.setWebViewClient(new MyCustomWebViewClient()); mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mainWebView.loadUrl("http://server.info-spot.net"); mainWebView.loadUrl("javascript:playVideo()"); } private class MyCustomWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } }

    Read the article

  • how to make the user add and delete in android

    - by user3678019
    i have 1 activity .. and in this activity i have 2 web view next to each other , i would like to add , ADD and Delete Button that can add one more web view next to the last web view , and the delete wish will delete any of the web view the user choose . and i want to make the user but it in the order he want like webview 1 first then webview 2 second how can i do this this is mu main.xml <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" tools:context="test.zezo.test.Main$PlaceholderFragment" > <HorizontalScrollView android:id="@+id/horizontalScrollView2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <WebView android:id="@+id/webView1" android:layout_width="350dp" android:layout_height="match_parent" android:layout_alignParentLeft="true" /> <WebView android:id="@+id/webView22" android:layout_width="350dp" android:layout_height="match_parent" android:layout_toRightOf="@+id/webView1" android:layout_alignParentLeft="true" /> </LinearLayout> </HorizontalScrollView> and this is a part of my main.java webView = (WebView) findViewById(R.id.webView1); String url = "http://google.com"; webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(url); webView.setWebChromeClient(new WebChromeClient()); webView.setWebViewClient(new WebViewClient()); WebView webView22 = (WebView)findViewById(R.id.webView22); webView22.getSettings().setJavaScriptEnabled(true); webView22.loadUrl("google.com); webView22.setWebChromeClient(new WebChromeClient()); webView22.setWebViewClient(new WebViewClient()); so how can i do the ADD and DELETE and re Order Buttons to it and one more thing it should be save so when he reopen the app it will be the same as after he add or delete or re order

    Read the article

  • Not able to play videos (from youtube) in WebView

    - by user1205193
    I am using a webview to display a video (could be from youtube or vimeo) in my app. In order to not load the video webpages in the default Android Browser, I am also extending the WebViewClient so I can override the shouldOverrideUrlLoading method. This way the video webpage loads successfully in the WebView. However, when I click on the embedded video on the WebView, it does not play. If I do not override the shouldOverrideUrlLoading method, and let the video webpages load in the default Android browser, the videos work just fine. Any ideas why the videos are not working in the WebView? Also, the main reason why I overrode the shouldOverrideUrlLoading method is because if I do not do that, then when I exit the Android browser to come back to my activity (by hitting the back button on the phone), I see a white screen. Upon hitting the back button twice, I am able to get back to my Activity. I am using the emulator to do this test. Here is my code: public class YoutubeLink extends Activity { WebView myWebView; String video_url; private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.youtubelink); //Retrieving data from ListSample.java Bundle extras = getIntent().getExtras(); if(extras !=null) { video_url = extras.getString("video_url"); Log.d("inside YoutubeLink.java", video_url); } myWebView = (WebView) findViewById(R.id.web); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.setWebViewClient(new HelloWebViewClient()); myWebView.loadUrl(video_url); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) { myWebView.goBack(); return true; } return super.onKeyDown(keyCode, event); }}

    Read the article

  • Webview shouldoverrideurlloading doesn't work

    - by Zak
    I have this code in my app: public class Home extends Activity{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.home); final ProgressDialog progressBar; if(isOnline()){ WebView webView = (WebView) findViewById(R.id.home_web); webView.setBackgroundColor(Color.parseColor(getString(R.color.colore_bg))); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setPluginsEnabled(true); webView.setWebViewClient(new MyWebViewClient()); progressBar = ProgressDialog.show(this,getString(R.string.caricamento),getString(R.string.attendere)); webView.setWebViewClient(new WebViewClient(){ public void onPageFinished(WebView view, String url) { if (progressBar.isShowing()) { progressBar.dismiss(); } } }); webView.loadUrl("http://www.mysite.com/android.php"); }else{ Toast.makeText(this,getString(R.string.no_connessione),Toast.LENGTH_LONG).show(); } } private class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { System.out.println("here"); if (Uri.parse(url).getHost().equals("mysite.com")) { // This is my web site, so do not override; let my WebView load the page return false; } // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } } public boolean isOnline(){ ConnectivityManager cm=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if(ni==null){ return false; } return ni.isConnected(); } } The shouldOverrideUrlLoading doesn't work, neither print the system.out, it seems to be never called. How can I repair this? I need to open all the link (except the main page www.mysite.com/iphone.php) in the default browser

    Read the article

  • Pop-Up Window at inital start up, of android application

    - by Josh Fairbank
    I am trying to find a code that will do a popup at the initial start up on an installed app. Much like a changelog that is starting to appear in more and more apps. I have found some similar codes, but being a beginner I haven't been able to figure out where to exactly put the code in and I always have tons of errors that still do not work once I try and fix them. I am working in Eclipse with an android project, and I'm using a webview to show a website. XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview" android:layout_height="fill_parent" android:layout_width="fill_parent" android:scrollbarAlwaysDrawVerticalTrack="false"/> </LinearLayout> Java File: package com.A2Ddesigners.WhatThe; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient; import android.view.KeyEvent; public class Whatthe extends Activity { WebView webview; /** Called when the activity is first created. */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) { webview.goBack(); return true; } return super.onKeyDown(keyCode, event); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview = (WebView) findViewById(R.id.webview); webview.setWebViewClient(new HelloWebViewClient()); webview.getSettings().setJavaScriptEnabled(true); webview.setInitialScale(50); webview.getSettings().setUseWideViewPort(true); webview.loadUrl("http://mdsitest2.com/"); } private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } }

    Read the article

  • Android @Override usage

    - by BahaiResearch.com
    (Newbie to Java, old time C# guy.) I have noticed a lot of the use of @Override in Android example code. I thought that all Java methods were by default "Virutal"? What then does @Override do? Example: private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }

    Read the article

  • Android ListActivity OnListItemClick error with Webviews

    - by Tista
    I've been figuring how to popup a webview all day when a row in my ListActivity is clicked. I can't even show a Toast when it's clicked. Need help I'm still new with Android, a web developer trying to learn. Thanks before. package com.mf.ar; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.AlertDialog; import android.app.ListActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.Window; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ArrayAdapter; import android.widget.Toast; public class ListViewer extends ListActivity { private String mJSON; private String[] listRows; private String[] listRowsURI; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.listview); Bundle the = getIntent().getExtras(); this.mJSON = the.getString("JSON"); Log.i("ListViewIntentJSON", this.mJSON); try { JSONObject UrbJSON = new JSONObject(mJSON); JSONObject UrbQuery = UrbJSON.getJSONObject("query"); int rows = UrbQuery.getInt("row"); Log.i("UrbRows", String.format("%d",rows)); JSONArray resultArray = UrbJSON.getJSONArray("result"); this.listRows = new String[rows]; for(int i=0; i<rows; i++) { this.listRows[i] = resultArray.getJSONObject(i). getString("business_name").toString(); } this.listRowsURI = new String[rows]; for(int i=0; i<rows; i++) { this.listRowsURI[i] = resultArray.getJSONObject(i). getString("business_uri_mobile").toString(); } } catch(JSONException e) { e.printStackTrace(); } this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ListViewer.this.listRows)); } @Override protected void onListItemClick(android.widget.ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); String theURI = ListViewer.this.listRowsURI[position].toString(); /*String theURI = ListViewer.this.listRowsURI[position].toString(); //String theURI = "http://www.mediafusion.web.id"; WebView webview = new WebView(this); //setContentView(webview); //addContentView(webview, null); webview.getSettings().setJavaScriptEnabled(true); getWindow().requestFeature(Window.FEATURE_PROGRESS); final Activity activity = this; webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { // Activities and WebViews measure progress with different scales. // The progress meter will automatically disappear when we reach 100% activity.setProgress(progress * 1000); } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show(); } }); webview.loadUrl(theURI);*/ Toast.makeText(ListViewer.this.getApplicationContext(), theURI, Toast.LENGTH_SHORT); } }

    Read the article

  • Android app in eclipse

    - by Colin
    Hello everybody, i've searched for days but cant find an answer, perhaps you guys can help. I'm creating an android app in eclipse, it all works just one thing is bugging me. this is my main.java: package com.test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; public class Main extends Activity implements OnClickListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Add Click listeners for all buttons View firstButton = findViewById(R.id.btn_rassen); firstButton.setOnClickListener(this); View secondButton = findViewById(R.id.button2); secondButton.setOnClickListener(this); } // Process the button click events @Override public void onClick(View v) { switch(v.getId()){ case R.id.btn_rassen: Intent j = new Intent(this, Webscreen.class); j.putExtra(com.test.Webscreen.URL, "http://www.google.com/"); startActivity(j); break; case R.id.button2: Intent k = new Intent(this, Webscreen.class); k.putExtra(com.test.Webscreen.URL, "http://notworkingurltotest.com"); startActivity(k); break; } } } now when it calls the webview.java the page called shows up but not the buttons i created in the layout xml page. does anybody have any idea why this is? your help is much appreciated! ohw this is my webscreen.java package com.test; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.Window; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; public class Webscreen extends Activity { public static final String URL = ""; private static final String TAG = "WebscreenClass"; private WebView webview; private ProgressDialog progressDialog; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.webscreen); this.getIntent().getExtras(); this.webview = (WebView) findViewById(R.string.webview); String turl = getIntent().getStringExtra(URL); Log.i(TAG, " URL = "+turl); WebView webview = new WebView(this); setContentView(webview); final Activity activity = this; webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } public void onLoadResource (WebView view, String url) { if (progressDialog == null) { progressDialog = new ProgressDialog(activity); progressDialog.setMessage("Bezig met laden..."); progressDialog.show(); } } public void onPageFinished(WebView view, String url) { if (progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } } public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Intent myIntent = new Intent(); myIntent.setClassName("com.test", "com.test.Main"); startActivity(myIntent); Toast.makeText(activity, "Laden van onderdeel mislukt, probeer het later nog eens! ", Toast.LENGTH_LONG).show(); progressDialog.show(); } }); webview.loadUrl(turl); } } webscreen.xml layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- <1> --> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/url" android:layout_height="wrap_content" android:layout_width="wrap_content" android:lines="1" android:layout_weight="1.0" android:hint="http://" android:visibility="visible" /> <Button android:id="@+id/go_button" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="go_button" /> </LinearLayout> <!-- <2> --> <WebView android:id="@string/webview" android:layout_width="fill_parent" android:layout_height="0dip" /> </LinearLayout>

    Read the article

  • Links sometimes not working in WebView

    - by littleFluffyKitty
    On occasion links in the WebView will not respond. The highlight press color will appear around them but nothing happens. I am also using WebViewClient's shouldOverrideUrlLoading and that function is not called when this happens. Edit: I have narrowed this issue down to the following circumstances: The webpage is the first page a WebView opens. The webpage uses meta name="viewport" attribute in the html head The WebView is using WebView.getSettings().setUseWideViewPort(true); Android 2.1 (Doesn't appear to happen in later versions, didn't test earlier) If a webpage meeting those above is opened no links will work. If another similar page is loaded, those links will not work either. It is not until you load a page without meta name="viewport" that links start to work. After a page without that meta attribute is opened and then you load a page with the meta viewport attribute, the links start working.

    Read the article

  • How to stop an iteration of TextView when click in on one of the TextView?

    - by sgiro
    Hello, i have one doubt. I have an iteration of TextViews, and what i want is when i click in one TextView , i want stop the iteration and open a web, who can i know what TextView as been click on? i have this code: Iterator it = text.iterator(); while(it.hasNext()){ test = it.next(); test.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //mWebView = (WebView) findViewById(R.id.webview); mWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl(url); } }); // condition to stop the iteration when i click on TextView } And what i want is the condition to stop the iteration when i click on the TextView that i want see, i try using some methods that are in the TextView and don't work. Anyone can help me? Thanks and forgive my English

    Read the article

  • Issue with webview with emulator and some devices Android

    - by Yasir Khan
    I am developing an application that is focuses on on WebView i am loading map from a webpage and calling subsequent java script request on it but i do not know what is happening with Galaxy Tab 7' and my emulator too after running well first time if i visit the application again its just showing blank page. Code: mMapView = (WebView) findViewById(R.id.mapview); mMapView.clearCache(true); mMapView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mMapView.getSettings().setJavaScriptEnabled(true); mMapView.loadUrl(mapurl); mMapView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { Log.e("Page loading","Url is :"+url); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // TODO Auto-generated method stub view.loadUrl(url); return true; } }); initially i thought its a cache problem and i added clearcache() without any help. :-(

    Read the article

  • android webView loading finished but it was a blank only I touch the screen can the content show Idont know why?and how it happened

    - by Sunday
    when my webView load this page , it was blank-page or white page only I touch the screen the content can only show private WebView webview; private ProgressDialog mProgressDialog; private Context mContext; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_web); mContext = this; webview = (WebView)findViewById(R.id.myWebView); String url = (String)getIntent().getExtras().get("url"); webview.getSettings().setJavaScriptEnabled(true); webview.setWebViewClient(new MyWebViewClient()); if(url!=null){ webview.loadUrl(url); } } class MyWebViewClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); mProgressDialog = ProgressDialog.show(mContext, "tips", "wate···the view is loading", true, false); } @Override public void onPageFinished(WebView view, String url) { mProgressDialog.dismiss(); super.onPageFinished(view, url); } }

    Read the article

  • Android application displays black screen after running

    - by frgnvola
    When I click "Run as an Android Application" on Eclipse, the following is displayed in the console [2014-06-05 20:07:18 - StudentConnect] Android Launch! [2014-06-05 20:07:18 - StudentConnect] adb is running normally. [2014-06-05 20:07:18 - StudentConnect] Performing sandhu.student.connect.SplashActivity activity launch [2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0 [2014-06-05 20:07:18 - StudentConnect] Refreshing resource folders. [2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0 [2014-06-05 20:07:18 - StudentConnect] Starting incremental Pre Compiler: Checking resource changes. [2014-06-05 20:07:18 - StudentConnect] Nothing to pre compile! [2014-06-05 20:07:18 - StudentConnect] Starting incremental Package build: Checking resource changes. [2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0 [2014-06-05 20:07:18 - StudentConnect] Skipping over Post Compiler. [2014-06-05 20:07:20 - StudentConnect] Application already deployed. No need to reinstall. [2014-06-05 20:07:20 - StudentConnect] Starting activity sandhu.student.connect.SplashActivity on device 0f0898b2 [2014-06-05 20:07:21 - StudentConnect] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=sandhu.student.connect/.SplashActivity } [2014-06-05 20:07:21 - StudentConnect] ActivityManager: Warning: Activity not started, its current task has been brought to the front After deployed to my phone, it only displays a black screen. I recently implemented a splash screen, but it was working fine before; however I think it might have something to do with the problem. Here are my java and xml files: MainActivity.java package sandhu.student.connect; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends Activity { public WebView student_zangle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView student_zangle = (WebView) findViewById(R.id.student_zangle); student_zangle.loadUrl("https://zangleweb01.clovisusd.k12.ca.us/studentconnect/"); student_zangle.setWebViewClient(new WebViewClient()); student_zangle.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); WebSettings settings = student_zangle.getSettings(); settings.setJavaScriptEnabled(true); settings.setBuiltInZoomControls(true); settings.setLoadWithOverviewMode(true); settings.setUseWideViewPort(true); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { WebView student_zangle = (WebView) findViewById(R.id.student_zangle); if ((keyCode == KeyEvent.KEYCODE_BACK) && student_zangle.canGoBack()) { student_zangle.goBack(); return true; } else { finish(); } return super.onKeyDown(keyCode, event); } } activity_main.xml <?xml version="1.0" encoding="utf-8"?> <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:background="@drawable/blue" tools:context=".MainActivity" > <WebView android:id="@+id/student_zangle" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> SplashActivity.java package sandhu.student.connect; import android.os.Bundle; import android.preference.PreferenceActivity; public class SplashActivity extends PreferenceActivity { @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.prefs); } } splash_activity.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/blue" android:orientation="vertical" > <ImageView android:id="@+id/imageView1" android:layout_width="250dp" android:layout_height="100dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="145dp" android:contentDescription="@string/zangle_logo" android:src="@drawable/logo" /> </RelativeLayout> Also, here is a full copy of the logcat error output: 06-05 20:19:46.698: E/Watchdog(817): !@Sync 1952 06-05 20:20:09.971: E/memtrack(16438): Couldn't load memtrack module (No such file or directory) 06-05 20:20:09.971: E/android.os.Debug(16438): failed to load memtrack module: -2 06-05 20:20:11.012: E/memtrack(16451): Couldn't load memtrack module (No such file or directory) 06-05 20:20:11.012: E/android.os.Debug(16451): failed to load memtrack module: -2 06-05 20:20:11.202: E/EnterpriseContainerManager(817): ContainerPolicy Service is not yet ready!!! Please help me figure out what is wrong, or at least point me in the right direction. Thanks in advance.

    Read the article

  • Android WebView - cannot understand - Null or empty value for header "if-none-match"

    - by ganesh
    Hi When i tried to load a url i get an exception as below Uncaught handler: thread WebViewCoreThread exiting due to uncaught exception 06-16 10:22:31.471: ERROR/AndroidRuntime(635): java.lang.RuntimeException: Null or empty value for header "if-none-match" 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.Request.addHeader(Request.java:161) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.Request.addHeaders(Request.java:179) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.Request.<init>(Request.java:132) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.RequestQueue.queueRequest(RequestQueue.java:480) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.RequestHandle.createAndQueueNewRequest(RequestHandle.java:419) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.net.http.RequestHandle.setupRedirect(RequestHandle.java:195) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.webkit.LoadListener.doRedirect(LoadListener.java:1216) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.webkit.LoadListener.handleMessage(LoadListener.java:220) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.os.Handler.dispatchMessage(Handler.java:99) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.os.Looper.loop(Looper.java:123) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:471) 06-16 10:22:31.471: ERROR/AndroidRuntime(635): at java.lang.Thread.run(Thread.java:1060) the code i am using is webview = (WebView)findViewById(R.id.generalwebview); webview.getSettings().setJavaScriptEnabled(true); webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { Log.i("ReserveBooking", "Processing webview url click..."); view.loadUrl(url); return true; } public void onPageFinished(WebView view, String url) { Log.i("ReserveBooking", "Finished loading URL: " +url); } public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Log.e("ReserveBooking", "Error: " + description); Toast.makeText(ReserveBooking.this, description, Toast.LENGTH_SHORT).show(); } }); webview.loadUrl(utls); and when i changed the emulator, this programs works without any error .Please help me to know the reason why i get this error ,is this error somehow related to cache? ,I shall be glad if someone explains ganesh

    Read the article

  • How can i know what TextView was clickbale?

    - by sgiro
    Hello, i have one doubt. I have an iteration of TextViews, and what i want is when i click in one TextView , i want stop the iteration and open a web, who can i know what TextView as been click on? i have this code: Iterator<TextView> it = text.iterator(); while(it.hasNext()){ test = it.next(); test.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //mWebView = (WebView) findViewById(R.id.webview); mWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl(url); } }); // condition to stop the iteration when i click on TextView } And what i want is the condition to stop the iteration when i click on the TextView that i want see, i try using some methods that are in the TextView and don't work. Anyone can help me? I have the iteration of TextViews because i want to do this dynamic, and i don't know the TextView who as click, and i want to know what TextView was click to stop the iteration, because if i don't stop this, for example if i have 3 TextView they will open the same web. Thanks and forgive my English

    Read the article

  • WebView and HTML5 <video>

    - by brian moore
    I'm piecing together a cheapo app that amongst other things "frames" some of our websites... Pretty simple with the WebViewClient... until I hit the video. The video is done as HTML5 elements, and these work fine and dandy on Chrome, iPhones, and now that we fixed the encoding issues it works great on Android... in the native browser. Now the rub: WebView doesn't like it. At all. I can click on the poster image, and nothing happens. Googling, I found http://www.codelark.com/2010/05/12/android-viewing-video-from-embedded-webview/ which is close, but seems to be based on a 'link' (as in a href...) instead of a video element. (onDownloadListener does not appear to get invoked on video elements...) I also see references to overriding onShowCustomView, but that seems to not get called on video elements... nor does shouldOverrideUrlLoading.. I would rather not get into "pull xml from the server, reformat it in the app".. by keeping the story layout on the server, I can control the content a bit better without forcing people to keep updating an app. So if I can convince WebView to handle tags like the native browser, that would be best. I'm clearly missing something obvious.. but I have no clue what.

    Read the article

  • webview in tabhost

    - by user1905845
    I am new to android. I am using webview inside tabview. In my app in first activity facebook button available.when click facebook button connect to facebook in second activity inside tabs fine.In second activity i am using webview. this is the code. public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.facebook); wvFacebook=(WebView)findViewById(R.id.webview); btnBack=(Button)findViewById(R.id.back); txtBarname=(TextView)findViewById(R.id.barnameheader); if(check==1){ strFacebook=MyBarsActivity.strFacebook; Log.e("Facebook url",strFacebook); strBarName=MyBarsActivity.strBarName; } wvFacebook.setWebViewClient(new MyWebViewClient()); wvFacebook.loadUrl(strFacebook); } private class MyWebViewClient extends WebViewClient { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.getSettings().setJavaScriptEnabled(true); view.loadUrl(url); return true; } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); // progressDialog.show(getParent(), "In progress", "Loading, please wait..."); } public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); } But my problem is when i click connect button facebook page will be displayed well inside tabs.But when i click emial or username and password button it is not responding.Why it is not responding please help me regarding this.thanks in advance.

    Read the article

  • PrgressDialog when load a WebView crash issue

    - by AndreaF
    I have an Activity with a WeView that load an url, and I want to display a little waiting dialog during the load of the site, so I have tried this: private ProgressDialog dialog = new ProgressDialog(MyNameActivity.this); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); setContentView(R.layout.web_view_activity); WebView wv; wv = (WebView) findViewById(R.id.areaWebSolver); wv.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { if (dialog.isShowing()) { dialog.dismiss(); } } }); dialog.setMessage("Loading..Please wait."); dialog.setCanceledOnTouchOutside(false); dialog.show(); wv.loadUrl(url); WebSettings webSettings = wv.getSettings(); webSettings.setJavaScriptEnabled(true); } Unfortunately doesn't works and the app crashes with a source not found... If I try to remove the Progress dialog code the activity works. What's wrong? How could I fix this?

    Read the article

1 2  | Next Page >