Search Results

Search found 7 results on 1 pages for 'webchromeclient'.

Page 1/1 | 1 

  • 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

  • html5 video source code [closed]

    - by Jeeva Nandhan
    !DOCTYPE html This is my vid.html file and my video1.js file is given below the .java file is public class MyWebAppActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView myWeb=(WebView) findViewById(R.id.webView1); myWeb.getSettings().setJavaScriptEnabled(true); myWeb.setWebChromeClient(new WebChromeClient()); myWeb.loadUrl("file:///android_assets/www/vid.html");}} Am receiving an error in emulator that Web page not available in the file:///android_assets/www/vid.html

    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

  • 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

  • JavaScript alert not working in Android WebView

    - by user655192
    In my application I am using WebView and in that I am using JavaScript alert( ) method but its not working, no pop-up appears. in my manifest file I have added <uses-permission android:name="android.permission.INTERNET"></uses-permission> and in activity file I have added mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl("file:///android_asset/demo.html"); In layout xml file I have added <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> Any clue how to enable full JavaScript in WebView. Update Thanks mark the alert() method in the html file are working now :) . Now there are two issues in WebView : 1: I am using a in the html file that i am loading in WebView , and trying to write in Hindi language font in it, but when i try to write Hindi text it displays as symbols ( rectangle symbols like [] ) . when i do the same in firefox browser on desktop it works fine. any clue how to give support for multiple language in textarea in WebView ? 2: When I am clicking submit and trying to open the value of text in alert() method in another java script it doesn't work , does it mean even after using WebChromeClient its applicable only for current loaded html page and not java scripts called from that page ?

    Read the article

1