0

I installed android studio in ubuntu recently and I'm pretty new to linux. I built an app that uses a switch widget. The problem is, when I tried to access the switch object using

Switch switch = (Switch) findViewByID(R.id.switch1);

I got an error saying that it is not a valid statement along with multiple errors like '(' expected, right after the the object name, the second word in the line, 'switch'

Out of curiosity, I went to Switch.java by ctrl clicking the class name. And over there I found over 72 errors.

This is what it looks like:

73 errors in Switch.java

I have downloaded the latest google APIs after seeing the response to this question. And I still don't know how to rectify it. I am asking this question here as a last resort. It most probably will be some silly mistake on my part while configuring the install. Please help me!

Community
  • 1
  • 1
Vishnu C
  • 3
  • 2

1 Answers1

1

switch is a Java language keyword so you can't use it as a variable name.

wero
  • 32,544
  • 3
  • 59
  • 84