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: ArrayAdapter Date: Thu, 31 Mar 2011 21:26:53 +0100 Organization: Dirk Bruere at Neopax Lines: 59 Message-ID: <8vk6c8Fe5gU1@mid.individual.net> References: <8vi26oFvh2U1@mid.individual.net> <8vj6efFla6U1@mid.individual.net> <8vjevuFn7mU1@mid.individual.net> <8vjhisFai4U1@mid.individual.net> <8vji5pFfcsU1@mid.individual.net> <8vjl9tFa13U1@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 5CiVTof715tcJRiK1fE/3AMzPZlrz44nf9A/CYBtnOBkhIhqJO Cancel-Lock: sha1:rEbRhmShGf1RMDL71NHExEKv/do= 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:2667 On 31/03/2011 18:09, Patricia Shanahan wrote: > On 3/31/2011 8:35 AM, Dirk Bruere at NeoPax wrote: > ... >> I get an error: "Syntax error on tokens, misplaced constructs". > > It probably means that you put the construct somewhere where it is not > permitted by the Java syntax. The actual issue, and what you need to do > to fix it, depends on where you put it in your code. > > Patricia Let's start again with my latest code that also does not work 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); lvRadio = (ListView)findViewById(R.id.ListViewRadio); } ... } public class BlinkAPI { private static Context mContext; static ListView radioLV; public BlinkAPI( Context ctx) { BlinkAPI.mContext = ctx; radioLV = (ListView )((Activity) mContext).findViewById(R.id.ListViewRadio); } private static void updateRadioTitles( ) { radioTitleAdapter = (ArrayAdapter) radioLV.getAdapter(); ...//Get titleStr etc radioTitleAdapter.add(titleStr); radioTitleAdapter.notifyDataSetChanged(); } This code crashes out -- Dirk http://www.neopax.com/technomage/ - My new book - Magick and Technology