Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm currently working on an Android application that uses Phonegap, and I would like to be able to "share" data between my Java code and my javascript code. Essentially, the user experience exists among the various html and javascript pages I have, but there are certain strings I want to pass to a javascript function when it is called from within the html page it is tied to.

Is this possible? I've seen some things about Applets, but don't fully understand what that means for my code. Assuming I can save the string I want as a String object somewhere in my java code, can I tell my javascript function to go find it, grab it, convert it to a javascript string object, and then work with it normally from there?

Thank you!

share|improve this question
    
One stackoverflow search away :) stackoverflow.com/questions/15653441/… –  Bogdan M. 2 days ago
    
Hey @BogdanM. thank you for your response. Unfortunately, that approach doesn't seem to work for me. The problem is that my string may not be set until after the file url is loaded, so appending it as a parameter won't be practical. It doesn't need to pass instantly, but as soon as it gets set to a value, I want to either pass it or be able to access it via javascript code. –  Dan 2 days ago
1  
Either write a phonegap plugin and make the data available through the plugin, or do it the hacky way like this –  Uncharted Space 2 days ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.