0

I am working on Android app with webview using javascript. I have an method which is returning Arraylist, i want to access it in my javascript. I know how to handle a single string returning from a method in javascript ,but i want to know about how to handle a Dataobject of arraylist in javascript.

1 Answer 1

0

There really isn't a good way to translate Java objects (other than primitives and Strings) across the Javascript bridge. What you probably want to do is convert your ArrayList into a JSON array and then pass the serialized representation over to the JavaScript code. You can then eval it or use JSON.parse to convert it into a JavaScript array.

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

3 Comments

Thanx Femi...Will u please provide me a good resource or documentation to do it...
Unfortunately I really don't have good documentation: the little I've done with this isn't really something I can share. I'd suggest taking a look at the source for the PhoneGap Android project at phonegap.com: they do extensive JavaScript bridge work.

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.