title: Android Studio error:<identifier> expected
body: <p>This SensorTestActivity.java in which Android Studio marks R in red:</p>
  
  <pre><code>package szabojanos.accelerometer;
  import android.app.Activity;
  import android.graphics.Color;
  import android.hardware.Sensor;
  import android.hardware.SensorEvent;
  import android.hardware.SensorEventListener;
  import android.hardware.SensorManager;
  import android.os.Bundle;
  import android.view.View;
  import android.view.Window;
  import android.view.WindowManager;
  import android.widget.Toast;
  
  
  public class SensorTestActivity extends Activity implements SensorEventListener {
  private SensorManager sensorManager;
  private boolean color = false;
  private View view;
  private long lastUpdate;
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
              WindowManager.LayoutParams.FLAG_FULLSCREEN);
  
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      view = findViewById(R.id.textview);
      view.setBackgroundColor(Color.GREEN);
  
      sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
      lastUpdate = System.currentTimeMillis();
  }
  
  @Override
  public void onSensorChanged(SensorEvent event) {
      if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
          getAccelerometer(event);
      }
  
  }
  
  private void getAccelerometer(SensorEvent event) {
      float[] values = event.values;
      float x = values[0];
      float y = values[1];
      float z = values[2];
  
      float accelationSquareRoot = (x * x + y * y + z * z)
              / (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH);
      long actualTime = event.timestamp;
      if (accelationSquareRoot &gt;= 2) //
      {
          if (actualTime - lastUpdate &lt; 200) {
              return;
          }
          lastUpdate = actualTime;
          Toast.makeText(this, "Az eszköz fel volt rázva", Toast.LENGTH_SHORT)
                  .show();
          if (color) {
              view.setBackgroundColor(Color.GREEN);
          } else {
              view.setBackgroundColor(Color.RED);
          }
          color = !color;
      }
  }
  
  @Override
  public void onAccuracyChanged(Sensor sensor, int accuracy) {
  
  }
  
  @Override
  protected void onResume() {
      super.onResume();
      sensorManager.registerListener(this,
              sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
              SensorManager.SENSOR_DELAY_NORMAL);
  }
  
  @Override
  protected void onPause() {
      super.onPause();
      sensorManager.unregisterListener(this);
  }
  </code></pre>
  
  <p>And this is android_sensor_test.xml layout file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" &gt;
  
  &lt;TextView
      android:id="@+id/textview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I was following this Tutorial: <a href="http://www.vogella.com/tutorials/AndroidSensor/article.html#tutorial-accelerometer" rel="nofollow noreferrer">http://www.vogella.com/tutorials/AndroidSensor/article.html#tutorial-accelerometer</a>
  Any help would be appreciated.</p>