Android :: App Launching - Execute Local Javascript File Using Phones Browser
Jul 12, 2010
Instead of launching a UI I was wondering if I could have a process monitor the execution of a javascript in the emulator's browser and read in the output data. Is it possible to execute a local javascript file using the phone's browser?
View 10 Replies
Aug 31, 2009
My open source application needs to browse local HTML files on the SD card, and WebView is not enough because I need history and bookmarks. I wrote the following code. It correctly opens the browser, but fails to reach catalog.html and in fact it just opens whatever page was last browsed:
Uri uri = Uri.parse("content://com.android.htmlfileprovider/sdcard/ myapp/catalog.html");
Intent intent = new Intent(); intent.setData(uri); intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); startActivity(intent);
View 2 Replies
View Related
Apr 6, 2009
I am writing a hybrid web/native app and ran into issue. My app downloads a music file via Java code, and needs to update a Javascript download progress bar in the WebView in real time.
My understanding is the only way to call Javascript from Java is via the WebView's loadUrl method.
CODE:................
View 6 Replies
View Related
Jul 8, 2009
I have put HTML document into a string variable and load it by using webView.loadDataWithBaseURL(null, htmlString, "text/html", "utf-8", null).
After that, I tried two ways and want to execute javascript function "exec()" by using
1. webView.loadDataWithBaseURL(null, "javascript:exec()", "text/ html", "utf-8", null) -> This will overlap the content of previous "htmlString" and shows "javascript:exec()" on the screen.
2. webView.loadUrl("javascript:exec()") -> There will be "Can't find variable: exec line: ..." in Logcat
I have tried to output "htmlString" to a file located in sdcard, and tried to use webView.loadUrl("file:///sdcard/xxx/a.xhtml") + webView.loadUrl("javascript:exec()").
And...it fails again! how to execute javascript function after loading html content by "loadDataWithBaseURL"?
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
Sep 22, 2010
Is it possible to add a JavaScript interface to the Android Browser the same way one can be added to the WebView Component as illustrated in this demo. My particular use case only needs JavaScript -> android so that I can send it back to the previous activity.
View 1 Replies
View Related
Jul 28, 2010
Or am I going to have to write an app to do that??
View 1 Replies
View Related
Sep 6, 2010
How to play video present in local file system (ex:in res/a.3gp) using VideoView .I am getting error as Video cant be played.Can any one help me in sorting out this issue?
View 2 Replies
View Related
Apr 27, 2013
I Want to run This File in my phone (via terminal emulator).
but after type ./amxxpc i have error
line 1: syntax error: unexpected "("
File which I Want to start is in scripting.zip
View 3 Replies
View Related
Feb 26, 2010
I have built a website for mobile webkit browsers, there is an interval update to refresh data. But it turns out that the pooling refresh will stop at some time after run for a while (some minutes or hours, different by each time).I thought there may be something error occurred in my refresh data functions, but it works well in my laptop browser. I also tried to listen window.onerror event, but webkit browser seems do not support that event. What else can I do?And I am also doubting is there any problem with setTimeout and setInterval functions in mobile webkit browser?
View 1 Replies
View Related
Oct 13, 2010
I want to launch an application in the phone by clicking its link in the browser..
View 2 Replies
View Related
Mar 23, 2010
Here is my question: Is it possible to launch a browser on Android and don't give the option to change page?For instance, if I launch a browser to stackoverflow.com, i want the user to navigate on the site, but don't give the ability to go to another site.
View 1 Replies
View Related
Jan 11, 2010
I want to List Item in Preference activity. and I want to launch a Browser with a URL which can change dynamically, When I click on that Item. Can anyone let me know how can i Achieve?
View 4 Replies
View Related
Aug 9, 2010
On the Google Products page, from an Android device, there is a "scan barcode" button that launches a 3rd party barcode scanning app, which returns results back to the browser. 1) How did they do this? 2) Is this available for any web developer to do, or a Google -> Google api only?
View 5 Replies
View Related
Jun 24, 2009
phones run without SIM cards on local Wi-fi networks. You can register with a mobile VOIP provider which gives you cheap calls at $0.02 / minute, voicemail and call display. The only thing you might miss is SMS, but hey... that's what GTalk is for. Can I live in this Utopia with the Magic? Can I break free of the corrupt wireless carrier cartel?
View 1 Replies
View Related
May 19, 2010
I got 2 java files app.java and gallaery.java
CODE:.....................
View 1 Replies
View Related
Jul 28, 2010
I am trying to execute a shell script from application using
java.lang.Process API.
The script file is executing properly as i am able to get logs but the line
*$SETPROP net.if.default rmnet0* * * is not getting executed.
has anyone able to execute .sh file from application succesfully.
Code Snippet: *//* *str={"/system/bin/sh","/sdcard/test.sh"};* *Process p = Runtime.getRuntime().exec(str);* * * *//* * * test.sh: LOG=/system/bin/log SETPROP=/system/bin/setprop $LOG -t test"++Setting up default iface"
$SETPROP net.if.default rmnet0 $LOG -t test"++Setting done "
View 5 Replies
View Related
Oct 12, 2010
Is there a setting to keep the browser from launching the phone dialer if I click a string of numbers by mistake?
View 2 Replies
View Related
Jun 29, 2010
I would like to know if there is a way of preventing a duplicate launch of browser/activity, while the user is already focused on it.mybe there is a way to detect before if the user's current screen is already focused on the same activity/browser i intent to launch?
View 2 Replies
View Related
Feb 18, 2010
I am able to launch browser and open site "google.com" and from my App successfully. I have a requirement that when the browser is launched from my application, I have to hide the address bar visible at top for that browser session. So can think of that I dont want the address that I am trying to open to be visible to users.Please let me if this is possible and and if yes how.
View 5 Replies
View Related
Jun 20, 2013
I found disabling javascript on my dolphin web browser make navigation really really fast almost 3 times faster and use a lot less data to charge a web and battery last longer...
The thing is most of the website i browse during the day i don't really need javascript plus if i use roaming i can browse a lot of more with my restricted data plan but some times for certain site i really need javascript or they don't even work or work really bad.
I tought would be really useful a shortcut wich enable/disable javascript on demand with just one click instead of going in setting every time.Do you think is possible trought a bookmarklet enable or disable js?Do you know other browsers at the same level of dolphin with this feature?
GT-I9505 on Tapatalk 2
View 1 Replies
View Related
Sep 6, 2011
I want to use my android device (4G Systems One Tab) to remotely execute a batch file on my PC via WIFI-Connection.
I want to have an Icon on my homescreen and when its clicked the batch-file on the desktop computer is executed. (no feedback or output needed, this is all done by the batch).
View 3 Replies
View Related
Nov 6, 2010
Does anyone know how to download javascript for x10? i cant log in to hotmail using the browser.. it keeps prompting javascript required to sign in.
View 6 Replies
View Related
Jan 15, 2010
Anyone know why, when I launch the browser (the droid is not rooted or modified in anyway) I get the GPS icon in my notification bar? Then sometimes it will not do this or the icon will go away after a minute or so.
View 6 Replies
View Related
Oct 10, 2010
I'm writing a JavaScript for an open source browser available for Android to replace the text in the body tag of the pages loaded into the browser with some different text. This should be worked in away that once a page get loaded into the browser, this JavaScript executes & the replacements take place & finally the page with replaced text is visible in the browser.
This is the replacing part of the code:
var textnodes, node, i;
textnodes = document.evaluate("//body//text()[not(ancestor::script) and not(ancestor::style)]",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
replace();
function replace() {
for (i = 0; i < textnodes.snapshotLength; i++) {
node = textnodes.snapshotItem(i);
text = node.data;
text = text.replace(/'/g, "'");
//The rest of the replacements node.data = text;
However document.evaluate seems to be not working. How to correct this code or any suggestions to do this replacing body text task in any other way?
View 1 Replies
View Related
Apr 6, 2009
Can one use an Android phone to access basically local (think intranet for example) web servers to view pages? I ask this question because some cell phones with some phone network appear to use a special server to funnel cell phone requests thru and that the server offloads from the browser part of what a browser normally does. I get the impression that the Opera mobile browser works this way.I want to talk to local devices that serve web pages and connect directly to them from phones. Does the Chrome browser in Android have the full functionality that Chrome has on a PC? Can it parse HTML, do XMLHttpRequest, and otherwise act like a modern browser?
View 2 Replies
View Related
Jun 2, 2010
First of all let me say that this questions is slightly connected to another question by me. Actually it was created because of that. I have the following code to write a bitmap downloaded from the net to a file in the sd card:
// Get image from url
URL u = new URL(url);
HttpGet httpRequest = new HttpGet(u.toURI());
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
HttpEntity entity = response.getEntity();
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
InputStream instream = bufHttpEntity.getContent();
Bitmap bmImg = BitmapFactory.decodeStream(instream);
instream.close();
// Write image to a file in sd card
File posterFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Android/data/com.myapp/files/image.jpg");
posterFile.createNewFile();
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(posterFile));
Bitmap mutable = Bitmap.createScaledBitmap(bmImg,bmImg.getWidth(),bmImg.getHeight(),true);
mutable.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
// Launch default viewer for the file
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(posterFile.getAbsolutePath()),"image/*");
((Activity) getContext()).startActivity(intent);
A few notes. I am creating the "mutable" bitmap after seeing someone using it and it seems to work better than without it. And I am using the parse method on the Uri class and not the fromFile because in my code I am calling these in different places and when I am creating the intent I have a string path instead of a file. Now for my problem. The file gets created. The intent launches a dialog asking me to select a viewer. I have 3 viewers installed. The Astro image viewer, the default media gallery (I have a milstone on 2.1 but on the milestone the 2.1 update did not include the 3d gallery so it's the old one) and the 3d gallery from the nexus one (I found the apk in the wild). Now when I launch the 3 viewers the following happen:
Astro image viewer: The activity launches but I see nothing but a black screen.
Media Gallery: I get an exception dialog shown "The application MediaGallery (process com.motorola.gallery) has stoppedunexpectedly. Please try again" with a force close option.
3D gallery: Everything works as it should.
When I try to simply open the file using the Astro file manager (browse to it and simply click) I get the same option dialog but this time things are different:
Astro image viewer: Everything works as it should.
Media Gallery: Everything works as it should.
3D gallery: The activity launches but I see nothing but a black screen.
As you can see everything is a complete mess. I have no idea why this happens but it happens like this every single time. It's not a random bug. Am I missing something when I am creating the intent? Or when I am creating the image file? As noted in the comment here is the part of interest in adb logcat. Also I should note that I changed the way I create the image file. Since I want to create a file that reflects an online file I simply download it instead of creating a Bitmap and then creating the file (this was done because at some point I needed the Bitmap but now I do it the other way around). The problems persist thought and are exactly the same:
I/ActivityManager(18852): Starting
activity: Intent {
act=android.intent.action.VIEW
dat=/sdcard/Android/data/com.myapp/files/image.jpg
typ=image/* flg=0x3800000
cmp=com.motorola.gallery/.ViewImage }
I/ActivityManager(18852): Start proc
com.motorola.gallery:ViewImage for
activity
com.motorola.gallery/.ViewImage:
pid=29187 uid=10017 gids={3003, 1015}
I/dalvikvm(29187): Debugger thread not
active, ignoring DDM send
(t=0x41504e4d l=38)
I/dalvikvm(29187): Debugger thread not
active, ignoring DDM send
(t=0x41504e4d l=64)
I/ActivityManager(18852): Process
com.handcent.nextsms (pid 29174) has died.
I/ViewImage(29187): In View Image
onCreate!
D/AndroidRuntime(29187): Shutting down VM
W/dalvikvm(29187): threadid=3: thread
exiting with uncaught exception
(group=0x4001b170)
E/AndroidRuntime(29187): Uncaught
handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(29187):
java.lang.RuntimeException: Unable to
start activity
ComponentInfo{com.motorola.gallery/com.motorola.gallery.ViewImage}:
java.lang.NullPointerException
E/AndroidRuntime(29187): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
E/AndroidRuntime(29187): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime(29187): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime(29187): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime(29187): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(29187): at
android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(29187): at
android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime(29187): at
java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(29187): at
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(29187): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(29187): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime(29187): at
dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(29187): Caused by:
java.lang.NullPointerException
E/AndroidRuntime(29187): at
com.motorola.gallery.ImageManager.allImages(ImageManager.java:5621)
E/AndroidRuntime(29187): at
com.motorola.gallery.ImageManager.getSingleImageListByUri(ImageManager.java:5515)
E/AndroidRuntime(29187): at
com.motorola.gallery.ViewImage.onCreate(ViewImage.java:1801)
E/AndroidRuntime(29187): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(29187): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
E/AndroidRuntime(29187): ... 11 more
View 3 Replies
View Related
Jul 1, 2009
I'm trying to read some local files, and ive been reading a lot of stuff about it, but i still don't know where to store the files on my phone and how to get the right path. Some say, it should be stored on /data/data/your.package.here/files but where is that, i mean i can get there when using the emulator but i have no clue how to put files in this on a real device.
View 7 Replies
View Related
Jul 26, 2010
All of the android examples for XmlPullParser pull from a local resource file, and all of the SAX examples pull the XML from a URL. I've been told SAX is faster, so I'm trying to use that to pull data from a local resource file (res/xml/thefile.xml)
The example code I'm working off of is here. So in that example, the code I want to change is:
URL url = new URL("http://example.com/example.xml");
...
xr.parse(new InputSource(url.openStream()));
Instead of using URL, I want to use getXml(R.xml.thefile)
Is that possible, or does SAX need to get data from a URL?
View 1 Replies
View Related
Nov 27, 2009
I'm trying to get a byte array of an image saved locally on the phone. I'm using the code...
How can I get the Bytes?
View 1 Replies
View Related