My data source is just a JSONArray I pass in to the constructor for my
spinner activity, and then to the Javascript when it is ready, along
with some other setup parameters.
If you look at the declaration for The AndoidBridge in my second message
you will see that it is a private class that just contains the functions
you want to be able to call from javascript, so you can set it up
however you want.
I took a lot of the code I started with from a tutorial somewhere on the
net... I think if you Google for "Android SpinnerActivity" you should
find it. Unfortunately, most of my code is already highly customized so
it's not really a great starting place.
On 13/07/2010 11:11 AM, kypriakos wrote:
Hi Brad,
What is the data source to your spinner? Or that is not necessary? I
guess because
I cannot see what is before this code segment I was curious how you
use that.
Also, I am not familiar with the AndroidBridge() - is that part of the
standard API?
Thanks
On Jul 12, 8:20 pm, Brad Gies<[email protected]> wrote:
Yes, you can read pages stored on the phone:
I'm using index.html here. Put it into your assets folder :
webView = (WebView)
spinnerView.findViewById(R.id.spinnerviewwebview);
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(new AndroidBridge(), "android");
webView.setVerticalScrollBarEnabled(false);
webView.setWebChromeClient(new WebChromeClient()
{
public void onConsoleMessage(String message, int
lineNumber, String sourceID)
{
}
});
webView.loadUrl("file:///android_asset/index.html");
The above also sets the WebView up to use Javascript.
On 12/07/2010 2:10 PM, kypriakos wrote:
In this case below, the URL can only be public and remote? I could not
read
a page stored locally on the phone - or is storing files locally not
an option?
Uri uri = Uri.parse("http://www.example.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Thanks
On Jul 12, 3:21 pm, Mark Murphy<[email protected]> wrote:
On Mon, Jul 12, 2010 at 3:10 PM, kypriakos<[email protected]> wrote:
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?
You can use WebView, but only from an Activity.
If you want to embed a Javascript interpreter, you can consider Rhino.
--
Mark Murphy (a Commons
Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
Android App Developer Books:http://commonsware.com/books
--
Sincerely,
Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro
Blurbhttp://www.bgies.comhttp://www.bistroblurb.comhttp://www.ihottonight.com
-----------------------------------------------------------------------
Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead
--
Sincerely,
Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro Blurb
http://www.bgies.com
http://www.bistroblurb.com
http://www.ihottonight.com
-----------------------------------------------------------------------
Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en