1

This is my Button in Android Studio

Button button = (Button) findViewById(R.id.button1);

Now i want to button.setOnClickListener but i cant, the auto completion is not working, and said "Cannot resolve symbol setOnClickListener"

Does anybody knows anything about this?

The autocomplete is not working for "setOnClickListener" but i can autocomplete other things

user3716096
  • 11
  • 1
  • 3
  • http://stackoverflow.com/questions/18370599/android-studio-auto-complete-and-other-features-not-working – Shivam Verma Jul 12 '14 at 03:35
  • sorry i ment to say that the autocomplete is not working for "setOnClickListener" but i can autocomplete other things – user3716096 Jul 12 '14 at 03:51
  • Use this directly : `button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } });` – Shivam Verma Jul 12 '14 at 03:54
  • I did but i Still get "Cannot resolve symbol setOnClickListener" i also get "Cannot resolve symbol v" – user3716096 Jul 12 '14 at 04:30
  • Ty Shivam Verma, the solution was in here http://stackoverflow.com/questions/18370599/android-studio-auto-complete-and-other-features-not-working – user3716096 Jul 12 '14 at 05:05

1 Answers1

2

You are not in any method probably you are trying to write that in the class scope. Try writing in onCreate method of your activity or some other method

Cynapsis
  • 118
  • 9