Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.lang.java.programmer Subject: Re: ArrayAdapter Followup-To: comp.lang.java.programmer Date: Sat, 02 Apr 2011 19:58:31 +1300 Organization: Geek Central Lines: 24 Message-ID: References: <8vi26oFvh2U1@mid.individual.net> <8vnd6rF2qlU1@mid.individual.net> <8vnhhhFseeU1@mid.individual.net> <8vnmbrFq40U1@mid.individual.net> NNTP-Posting-Host: 118-92-92-183.dsl.dyn.ihug.co.nz Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: lust.ihug.co.nz 1301727512 1401 118.92.92.183 (2 Apr 2011 06:58:32 GMT) X-Complaints-To: abuse@ihug.co.nz NNTP-Posting-Date: Sat, 2 Apr 2011 06:58:32 +0000 (UTC) User-Agent: KNode/4.4.7 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2726 In message <8vnmbrFq40U1@mid.individual.net>, Dirk Bruere at NeoPax wrote: > On 02/04/2011 05:12, Lawrence D'Oliveiro wrote: >> In message<8vnhhhFseeU1@mid.individual.net>, Dirk Bruere at NeoPax wrote: >> >>> Perhaps I ought to try google - watcha think? >> >> What was wrong with passing the ArrayAdapter to the BlinkAPI constructor? > > Simply put, I pass the context to the constructor. > However, I do not know how to access the ArrayAdapter using the context. Ah, I see, you have a circularity in that the ArrayAdapter refers to the BlinkAPI instance, but BlinkAPI needs access to the ArrayAdapter. It seems to me you need to separate UI code from data-model code to break the cycle. How about doing this: * Define a class, say BlinkItem, that contains all the state for a single item in the list, with no reference to any UI widgets. * Define a subclass of ArrayAdapter which implements the UI for displaying/manipulating a list of BlinkItems. How does that sound?