1

I'm trying to get a javascript variable from my webview and convert it to a String variable in Java. But i'm new to javascript and can't figure out how i can do this.

Can anyone help me?

2 Answers 2

2

How about using the Android Java/JavaScript bridge to send data between the two layers. The integration technique is part of the core Android framework.

PhoneGap is also great but is overkill if you just want to stick to Android

Here is a tutorial on how this stuff works: http://code.google.com/p/openmobster/wiki/JavascriptBridge

Full Disclosure: I am the Chief Engineer of OpenMobster and I wrote this tutorial

Sign up to request clarification or add additional context in comments.

2 Comments

This is very interesting, I would definitely take a look at this.
thnx alot, looks verry good. I just tryed it out and it works perfectly
1

There is no easy way to just pull a variable from client side javascript into application level Java. Hopefully someone can come along and give a good original answer. However, the PhoneGap library has an easy way to do this. PhoneGap can tie javascript events to native application events which is extremely useful. If you really want to do this I would recommend at least checking out PhoneGap.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.