What's wrong with having a individual onClick handlers for each view. So what happens if you 100 views? WIth your "style", you will have a giang if/switch statement with 100 branches, instead of his easily understandable small pieces of code.
I'd suggest you to adapt his "style" of coding. On Jun 21, 9:01 am, 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

