Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Dirk Bruere at NeoPax Newsgroups: comp.lang.java.programmer Subject: Re: ArrayAdapter Date: Sat, 02 Apr 2011 14:48:33 +0100 Organization: Dirk Bruere at Neopax Lines: 35 Message-ID: <8vonp8FvbaU4@mid.individual.net> References: <8vi26oFvh2U1@mid.individual.net> <8vnd6rF2qlU1@mid.individual.net> <8vnhhhFseeU1@mid.individual.net> <8vnmbrFq40U1@mid.individual.net> Reply-To: dirk.bruere@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 2rv2k0qaiT9PZOlas83jbALGrwX/6zLzdG+xXslIVSZ4AfQT1y Cancel-Lock: sha1:aJQauiG0WKKo3kCuJWVMNv6u9h4= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2748 On 02/04/2011 07:58, Lawrence D'Oliveiro wrote: > 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? It's got to be better than my non-working approaches so far. I will try it. Another problem - What does passing context to a class mean if every item and method in it is static? -- Dirk http://www.neopax.com/technomage/ - My new book - Magick and Technology