Hi I've got an app that spawns of a seperate thread. Parses JSON data into a structure. And passes it back to the main thread through a handler. Each part of data is sent through the handler individually. That worked fairly well with my previous XML parser, as XML parses data while it downloads. But JSON doesn't (atleast I haven't found a way to get that working). In either way the JSON data is much smaller and much faster to parse.
I've recently added a feature that requires me to load several sources of json in parallel, parse in the background, and pass all the data back again using a Handler. This is a bit slower than I was hoping. Would it be faster (and possible) for me to do this: BackgroundThread extends Thread { onCreate (Parent) { this.parent = parent; } onData { parent.addParsedData(x); } } Parent extends ListActivity { ListAdapter list; onCreate { setListAdapter(list); new BackgroundThread(this); } public synchronized addParsedData(data) { list.add(data) } } I'm thinking this won't be thread safe, as ListAdapter is in the parent thread. Am I right? Should I instead inside the listadapter (which puts data in an array) have synchronized access to it's items? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en