Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Dirk Bruere at NeoPax Newsgroups: comp.lang.java.programmer Subject: Initializing from context passing Date: Sat, 23 Apr 2011 16:39:13 +0100 Organization: Dirk Bruere at Neopax Lines: 42 Message-ID: <91ga4tF38vU1@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 msPHLdxveXYNeoQTU9OphQY9uCBH8DXhkDc5BbuW0HgerQHXVm Cancel-Lock: sha1:mfRYez5taWGbXISHD1FlcYot5N0= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3217 I have a Data class of the form: Data ( public static ListView albumsLV; public static ArrayAdapter albumsTitleAdapter public static ArrayList albumsTitleArrayList = new ArrayList(); Data(Context ctx) { albumsLV = (ListView )((Activity) ctx).findViewById(R.id.ListViewAlbums); albumsTitleAdapter = new ArrayAdapter(ctx, android.R.layout.simple_expandable_list_item_1,albumsTitleArrayList); } } and in the main method{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Context currentContext = this; Data data = new Data(currentContext); } lvAlbum = (ListView)findViewById(R.id.ListViewAlbums); lvAlbum.setAdapter(Data.albumsTitleAdapter); } I never use Data data variable again. Is that sufficient to initialize the static parameters in Data class? -- Dirk http://www.neopax.com/technomage/ - My new book - Magick and Technology