One of my projects suddenly changed to JDK Compliance Level 1.5 without me ever setting it. I think I may have checked it out of SVN wrongly. Went in to Project Properties, Java Compiler to fix it.
On Jun 23, 8:31 am, Mark Murphy <[email protected]> wrote: > OnClickListener is an interface. If you are compiling with Java 1.5, > you cannot use @Override on implementations of interface methods. That > was added in Java 6. > > > > > > > > > > On Mon, Jun 20, 2011 at 9:01 PM, Kromosome <[email protected]> wrote: > > I am having to modify some code from another developer's codebase and > > his coding style is totally different to mine. Take the following for > > instance, instead of having a single onClick handler for all views, > > the developer has implemented the onClick function inline for each > > event. > > > In the Eclipse IDE, I am getting the following error, "The method > > onClick(View) of type new View.OnClickListener(){} must override a > > superclass method". > > > If I look to the quick fix it tells me to, "Remove the @Override > > annotation", however when doing so, the error is corrected. This seems > > to be the reverse of my understanding in that the superclass must be > > overriden. Has anyone seen or encountered this previously? Any > > suggestions? Would it have something to do with the fact that the > > superclass method is overrided multiple times in a similar manner? > > > <code> > > > llSelDOB.setOnClickListener(new OnClickListener() { > > @Override > > public void onClick(View v) { > > StringDOB = new String(); > > Calendar c = Calendar.getInstance(); > > int cyear = c.get(Calendar.YEAR); > > int cmonth = c.get(Calendar.MONTH); > > int cday = c.get(Calendar.DAY_OF_MONTH); > > > DatePickerDialog dp = new DatePickerDialog(Registration.this, > > mDateSetListener, cyear, cmonth, cday); > > dp.show(); > > } > > > </code> > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Training in London:http://bit.ly/smand1,http://bit.ly/smand2 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

