b.setOnClikListener(new OnClickListener() { public void onClick (View v) { Intent intent = new Intent(ActivityA.this, ActivityB.class); startActivity(intent); } }); 1 answer
Try to specify the full path of the View.OnClickListener interface:
b.setOnClikListener(new View.OnClickListener() { @Override public void onClick (View v) { Intent intent = new Intent(ActivityA.this, ActivityB.class); startActivity(intent); } }); Also, it is useful to specify the overriding method overrides. But this is optional.
- Annotation just will not change anything - pavlofff
- @pavlofff, but it won't be any worse either, especially since you wrote the link yourself that its absence could lead to a difficult to calculate error. Here, recently, an example was where the written, but optional annotation helped to find the error. - Yuriy SPb ♦
- @pavlofff, it will not change anything, nevertheless I would personally contemptfully look at the person who deliberately removes them. - Vladyslav Matviienko
- @metalurgus Of course both of you are right, I just wanted to say that this cannot be a solution to the problem, that is, from the absence or presence of annotations, the problem will not arise and will not be solved. - pavlofff
- @pavlofff, slightly edited the answer - YuriySPb ♦
|