Struggling with SSA (no, not what you might think!*)

'scuse shouting, this is frustrating.

The latest thing I've tried is:
        DatePicker WeddingDate = (DatePicker)findViewById(R.id.datepicker);
 based on an example I found for implementing an OnClickListener.

[OnClickListener being a method which can look out for an action by the user and take action when it is detected.]

However, Eclipse doesn't like this - the specific error it's giving me is

The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (SplashScreenActivity)
 The above is shown in red to give some inkling of how angry Eclipse is with me. Now, I actually just realised an error in the above - I already defined WeddingDate as a DatePicker above, so re-defining it like this is just going to confuse Eclipse. So I take that out to get:
WeddingDate = (DatePicker)findViewById(R.id.datepicker
Main difference? WeddingDate is now highlighted in blue - Eclipse has recognised it as a defined object. The error is still marked, however.
My best guess is that I shouldn't be using an OnClickListener on a DatePicker. Hmmm. There is a way to use auto-completion to check that.

Aha. By typing
I get a list of methods whose names begin "set" that might apply to the object WeddingDate. It's a long'un, but the beginning looks something like this:

and as I go down the list, setOnClickListener is a valid option.

Better yet, when I take the suggested variable of setOnClickListener(l) I get a different error.
l cannot be resolved to a variable
Which is fine, because it shows me that the previous error related not to the method setOnClickListener, but only to the argument, which the first time is "this" and the second time is "l". They've given me different errors because in Java "this" has a default meaning (thus the purple colouring) and "l" does not.

I do not know how to resolve this at present, but I'm sure I can come back to it.

*I realized after dubbing my SplashScreen as SSA** for the purposes of this blog that in the parlance of American Evangelicals SSA stands for same-sex attraction; as such "struggling with SSA" is the process that homophobic Evangelicals have to go through if they realise they are homosexual.
I don't feel attracted to men, and even if I did it wouldn't change the fact that I am attracted to women; so not only is the wedding still on, but the post title might be misleading to people from that world.

** I learn from the fiancée that SSA is also a term in Chemistry for the Steady-State Approximation.

† SSA also stands for the Secular Student Alliance who are all kinds of awesome if you're USian and not so keen on the Religious Right.

Nested footnotes FTW!

No comments:

Post a Comment