Implement your subclass of BaseAdapter (e.g. JSONArrayAdapter). Implement/override the getCount(), getItem(int position), etc. to make your BaseAdapter a proper list-adapter around your jsonarray.
Implement the getView method; it provides the 'position' and 'contentView' parameters. - Use position and getItem(position) to obtain an json-element from your jsonarray. - re-use contentView or create a brand-new one if it is null: - Assign text/images to the contentView (or its child-view) based on the json-element you got. Then assign an instance of your JSONArrayAdapter to your list- or grid- view. And viola. It should work :) Take a look at the 'API Demo' in the Android SDK for examples. On Sep 29, 3:45 pm, vorcigernix <vorciger...@gmail.com> wrote: > Ok, I don't get a BaseAdapter logic, I assume because I am not used to > java. I found tons of examples on net (mostly for drawing pictures > etc) but it make no sense to me. For example, list4 from sdk do > something similar, but...where are they binding data? I see where data > is set to custom class, but what actually returns data from > BaseAdapter? GetView? > Thanks for any clarification > Adam > > On Sep 28, 8:15 pm, Mark Muphy <mmur...@commonsware.com> wrote: > > > > > vorcigernix wrote: > > > Hello, > > > I made my application from various examples and sources, so now I have > > > filled jsonarray and prepared listview (with custom rows formatting). > > > Now I need to replace > > > > ListAdapter myAdapter =(new ArrayAdapter<String> > > > (this,R.layout.rowlayout, R.id.TextView01, values)); > > > > with my json array based adapter. All I found is some technique to > > > iterate through all json records and construct string array. It sound > > > like perverse to me, is it really necessary? > > > Create your own adapter class from BaseAdapter, and you can traverse > > your JSON however you want. > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Need Android talent? Ask on HADO!http://wiki.andmob.org/hado- Hide quoted > > text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---