Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Dirk Bruere at NeoPax Newsgroups: comp.lang.java.programmer Subject: Re: Java OOP tutorial (Was: ArrayAdapter) Date: Thu, 31 Mar 2011 13:16:41 +0100 Organization: Dirk Bruere at Neopax Lines: 82 Message-ID: <8vj9l5FeacU1@mid.individual.net> References: <8vi26oFvh2U1@mid.individual.net> <8vj6efFla6U1@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 Q+ciUtXSvt5jwvseGx64RQc8YMULG0ITXrdXCCz34+uCY0Nz/b Cancel-Lock: sha1:yrTVno6R4KQv0no4oXZgE7BScsU= 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:2645 On 31/03/2011 12:52, Michal Kleczek wrote: > Dirk Bruere at NeoPax wrote: > >> >> public class controller extends Activity { >> >> /** Called when the activity is first created. */ >> @Override >> public void onCreate(Bundle savedInstanceState) { >> super.onCreate(savedInstanceState); >> setContentView(R.layout.main); >> >> Context currentContext = this; >> final BlinkAPI blinkAPI = new BlinkAPI(currentContext); >> >> >> lvVideo = (ListView)findViewById(R.id.ListViewVideo); >> radioTitleAdapter = new >> > ArrayAdapter(this,android.R.layout.simple_expandable_list_item_1,BlinkAPI.videoArrayList); >> lvVideo.setAdapter(radioTitleAdapter); >> } >> ... >> } >> >> //******************************************* >> public class BlinkAPI { >> >> private static Context mContext; >> static ListView albumsLV, videoLV, tracksLV, artistsLV, radioLV; >> >> >> public BlinkAPI( Context ctx) >> { >> BlinkAPI.mContext = ctx; >> >> radioLV = (ListView )((Activity) >> mContext).findViewById(R.id.ListViewRadio); >> >> } >> >> private static void updateRadioTitles( ) { >> >> ... >> radioTitleAdapter.add(titleStr); > //PROBLEM >> radioTitleAdapter.notifyDataSetChanged(); //PROBLEM >> } >> >> How do I get at radioTitleAdapter? >> > > There are so many issues with the code above that answering your direct > question does not make sense IMHO (but surely someone is going to answer it > and additionaly point out the issues). > So in hope to be bright and suggest you to search Google for an OOP tutorial > (possibly in Java) - I actually did: > http://www.google.pl/search?q=java+object+oriented+programmin+tutorial > > And you know what - nothing really useful! A lot of material covering > (somewhat like in an encyclopedia) what an object/class/instance > variable/method is but nothing really _introductory_ that would illustrate > "live objects communicating with each other to achieve a goal". > > Does anybody know of anything like this online? > The problem is accessing something located in: public void onCreate(Bundle savedInstanceState) I thought I could do it with context. I can certainly access (say)a ListView defined in onCreate by including videoLV = (ListView )((Activity) mContext).findViewById(R.id.ListViewVideo); in public BlinkAPI( Context ctx){} I do not know a corresponding way to get an adapter -- Dirk http://www.neopax.com/technomage/ - My new book - Magick and Technology