简体   繁体   中英

Android Data Object interaction with JavaScript

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.

There really isn't a good way to translate Java objects (other than primitives and String s) 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM