Android :: Android - Loading External JS File Into Webview And Functions Access
Oct 19, 2010
I have a JS file that has functions to search a document for substrings. I want to access functions inside this file by passing parameters to it (the search keyword). I know we can use .loadUrl("javascript:~~~~~) but I'm not clear on how to do it using multiple functions.
View 1 Replies
May 27, 2009
when I load external web page, image or javascript file from local webpage. I can't see external image and can't load javascript or webpage. But I can only see local image. Why I can't load external javascript, webpage or image? Here is the HTML source. (of course, I filled right [daum open API key])
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta
http-equiv ="Content-Type" content="text/html;
charset=UTF-8"> <title>Daum 지도 API</title>
<script type="text/javascript"
src="http://apis.daum.net/maps/maps.js?
apikey=[daum open API key]" charset="utf-8"></script> </head> <body>
<div id="map" style="width:600px;
height:400px;
" style="border:1px solid #000">
</div> <img src="http://4.bp.blogspot.com/_2-7AdSkZA7I/RlCnDhD3ZfI/ AAAAAAAAE9U/LEHMtyVLdY8/s400/CutyTale10.jpg">
<img src="file:///android_asset/coffeebean.jpg">
<script type="text/javascript">
var map = new DMap("map", {point:new DLatLng(37.48879895934866, 127.03130020103005), level:2} );
</script> <iframe src="http://www.daum.com" width="300" height="150"></iframe> </body> </html>
and I use this Activity source
package bo.my.android.test;
import android.app.Activity;
import android.os.Bundle; import android.webkit.WebView;
public class OpenAPITest extends Activity {
WebView webView;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView = (WebView) findViewById(R.id.webView1);
webView.setWebViewClient(new DaumMapClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/daummap.html");
//webView.loadUrl("http://www.daum.net");
} }
View 3 Replies
View Related
May 8, 2012
how to program/write code on a "webview" in Android for loading a html file?
View 2 Replies
View Related
Jun 3, 2010
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 {
I already have JavaScript on the web browser on, the problem is the web view is acting to different from the web browser.
View 1 Replies
View Related
Jun 6, 2010
Is it possible to mount an external USB thumb drive to access its data from a file browser on the phone? I tried plugging one of my USB drives into a USB-to-microUSB adapter and plugging that into the phone, but it didn't mount anywhere.
View 10 Replies
View Related
May 19, 2010
I want to make an image appear in webview to utilize the zoom functions.
View 1 Replies
View Related
Jun 28, 2013
Is there any way to access core Android functions like app switching (holding down the Home button for a few seconds), to be used in other contexts? Similar to how you can access Activities from the apps installed and use them as Shortcuts.
What I'd like to do is this:
press Home -> bring up app switching interface
long-press Home -> go to Home screen
Basically I want to reverse the two functions that short and long pressing the Home button does.
If not that, I'm also interested in being able to access the "app switching interface" via a Shortcut (like a Shortcut you place on your Home screen), or via an app.
For example, you can long-press on the Home screen and add a Shortcut (different than adding a shortcut to an App) which basically includes various context functions of some of the apps you have installed. I want to be able to do this - add a Shortcut - in which the Shortcut I add launches the "app switching interface" that you normally get by long-pressing the Home button. That way I can put that Shortcut in Wavelauncher or wherever else I want to be able to app switch without the annoyance of having to long-press something.
View 5 Replies
View Related
Jan 1, 2010
I'm trying to load the parsed HTML data from an rss feed using a WebView, but the webview claims...
View 3 Replies
View Related
Nov 5, 2010
In my application I load a couple of images from JPEG and PNG files. When I place all those files into assets directory and load it in this way, everything is ok:
CODE:..................
But when I try to load the exact same images from sd card, I get an OutOfMemory exception!
CODE:..............
This is what I get in the log:
CODE:...........
UPDATE: Tried both of these on real device - it seems that I can't load more than 12MB of bitmaps into whatever is called "external memory" (this is not an sd card).
View 7 Replies
View Related
Jul 29, 2013
I am using and android 2.2 phone for testing and getting an error.
07-27 01:24:55.692: W/System.err(14319): java.lang.ClassNotFoundException: com.shoaib.AndroidCCL.MyClass in loader dalvik.system.DexClassLoader@43abbc20
First I wrote the following class:
Code:
package org.shoaib.androidccl;
import android.util.Log;
public class MyClass {
public MyClass() {
Log.d(MyClass.class.getName(), "MyClass: constructor called.");
}
public void doSomething() {
Log.d(MyClass.class.getName(), "MyClass: doSomething() called.");
}
}
And I packaged it in a DEX file that I saved on my device's SD card as `/sdcard/testdex.jar`.
Then I wrote the program below, after having removed `MyClass` from my Eclipse project and cleaned it:
Code:
public class Main extends Activity {
[MENTION=1299008]supp[/MENTION]ressWarnings("unchecked")
[MENTION=439709]override[/MENTION]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
[code]....
View 2 Replies
View Related
Oct 12, 2009
I am trying to create a hybrid Android app which pulls HTML content from a web server and renders it in a WebView. However, I also want the external HTML to be able to reference images that are packaged within the android app. I realize that currently it is not possible to do something like <img src="file:///my_image.jpg" /> in the HTML. I have seen discussions of using the ContentProvider to create name spaces in the html, however all of these examples seem to assume that the actual html page is also on the device and tend to use WebView.loadData(). So, is there someway that it is possible to do this? The main goal is to package all the application images/css in the android app, but put the bulk of the application on an external server that returns the actual markup.
View 2 Replies
View Related
Sep 13, 2010
I've been messing with Android for a couple of weeks, i found many tutorials to follow, but i didnt find anywhere some "Style rules" to make the code looks better. I would like to know if its possible (im sure that it is, but dont know how to make it xD) to use more .java files to organize the functions. I mean, right now, i have myApp.java where i coded all my application, but is starting to grow so much, so i would like to separate some functions into another .java file. As i told before, im almost sure that this is possible, but i dont know how to link that second file so, can anybody help me?
View 2 Replies
View Related
Feb 8, 2010
How can I cancel a loading operation in WebView started by loadData() method?
View 1 Replies
View Related
Jul 20, 2010
OK so I have an rss reader that links to articles. One of the sites it links to doesn't have a mobile view. I was wondering if anyone knew if it was possible to set the "zoom" and position of the view once the page is loaded? So for instance if the following link were my article... http://www.neworleanssaints.com/news-and-events/article-1/Saints-agree-to-terms-with-7th-round-pick-Sean-Canfield/cce6a9ca-eaee-4878-ad40-0b98609f7fe7 Then how could I have the view focus on the article without the user having to zoom in and scroll the the top of the article.
View 1 Replies
View Related
Feb 13, 2010
I am loading a URL whose datatype is String in a WebView. Using something like:
webview.loadUrl(string_variable);
but it is automatically redirected to the browser.
I got this in my LOGCAT,
CODE:............................
View 2 Replies
View Related
Oct 12, 2010
I have a .swf file and i want to open it into webview and also wanna play flash games loaded there in webview.
View 1 Replies
View Related
May 26, 2010
I would like to a WebView to run some JavaScript before loading the rest of the page. This JavaScript should run in the same context of the page, just as if extra <script> content were added before any other <script> content. This is not possible with add Java script Interface() since I want to set up some instance variables, before the page scripts are run, so that the page scripts can use them.
View 5 Replies
View Related
Aug 5, 2010
I want to open twitter auth in my webview rather then opening in browser, any good tutorial how to play with webview in dialog and loading it inside dialog?
View 1 Replies
View Related
Jun 30, 2010
I have a webview that is loading a page from the Internet. I want to show a progressbar until the loading is complete. How do I listen for the completion of page loading of a WebView?
View 4 Replies
View Related
Sep 16, 2010
I have a big problem and i did not find a solution for my problem. I try to load an url and i use this tutorial: http://developer.android.com/reference/android/webkit/WebView.html. My Code...
View 1 Replies
View Related
Sep 24, 2010
i have an application which loads urls from a website. Now i want that the aplication uses the cache when offline. But i just get the failure site which says that im not connected to the website. At first i set the Cachmode to Load_Normal but this doesnt help. Next i tried a realy "silly" approach using the ConnectivityManager:
cm = (ConnectivityManager) this.getSystemService(Activity.CONNECTIVITY_SERVICE);
if(cm.getActiveNetworkInfo().isConnected()){
mfnWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
mfnWebView.loadUrl(url);
}
else{
mfnWebView.getSettings().setCacheMod e(WebSettings.LOAD_CACHE_ELSE_NETWORK);
mfnWebView.loadUrl(url);
}
but this just leads to crashing the application. Is there a simple way to load the cache when offline and existing. And just if not existing showing the failure message.
View 1 Replies
View Related
Mar 25, 2009
I can not access the external network because of DNS problem, below is my steps:
1. Setup DNS ./adb shell setprop net.dns1 xx.xx.xx.xx
I can successful access the internal network withou setting the http_proxy, such as my.mycomany.com
2. Setup proxy Setup the http_proxy environment variable on the host, and setup the dns server in Android.
Access the external network in browser, such as www.google.com. It report "Web page not available", the log of logcat say that: I/InetAddress( 187): Unknown host www.google.com, throwing UnknownHostException E/browser ( 187): onReceivedError code:-2 The URL could not be found.
Setting the http_proxy in "sqlite3 /data/data/ com.android.providers.settings/databases/settings.db" also does not work.
I guess it is the dns issue. But strange that the DNS can work for internal network, but can not work for external network.
Does anyone know how to fix this issue?
View 7 Replies
View Related
Mar 17, 2010
I'm new bie to android.. i want to access external database from my android application.. I've searched so much time in the Internet but could not get exact idea how to implement?
Please help me If any one is having idea on that and post if u have any code related to it.
View 24 Replies
View Related
May 22, 2010
Is there an app that can help me access my computer's files or just make my phone become an external disk over the wifi? if so can u plz tell me which apps or software i need to install?
View 7 Replies
View Related
Sep 10, 2010
We are making an application that needs to convert one file format to another. I am not sure whether we can add a JAR file in which we develop the code to convert the file format to our required file format, to our android project.
View 1 Replies
View Related
Jun 28, 2010
Is there a way to view the http response headers in an Activity once a web page has been loaded in a WebView? Seems like this should be possible, but I can't find any methods that expose the headers.
View 1 Replies
View Related
Apr 1, 2010
I love the BarCode Scanner application for the Android phone (we're using Motorola's Droid). Is it possible to access the BarCode Scanner from a web application running on the phone? I was thinking of using a WebView, but I'm not sure how I'd access the Scanner API.
View 2 Replies
View Related
Oct 18, 2010
Does anyone know how to access programatically the internal(flash) and external(sd card) storage values such as space used and space available? I cant seem to find an api anywhere?
View 4 Replies
View Related
Jun 30, 2010
I have some xml files with a custom format (based on the scxml specifications) that I want my program to read. I've already written the code to read it, but I'm running into problems actually reading the file itself. I want the file to be compiled with the apk, as it will not be changed at all during run time. So I put the file (test.xml) in the res/xml/ folder, and got the inputstream by using:
getResources().openRawResource(R.xml.test);
But when I read in this inputstream it is complete jibberish, which makes me suspect it is being read in binary, as openRawResource() is often used for binary files like images, if I am correct. What is the correct way to do this?
View 11 Replies
View Related
May 31, 2010
Is it possible to open an external file in Android? (As XmlPullParser)
View 2 Replies
View Related