I keep getting this error saying "Syntax error on token "}", delete this token." on the last line, why? I have searching for the error but I can't seem to find it. As you can see it's a service, calling on another service every once in a while.
package com.iggeman.updater; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; public class UpdaterService extends Service { private static final String TAG = UpdaterService.class .getSimpleName(); private Updater updater; public boolean isRunning = false; @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); updater = new Updater(); Log.d(TAG, "onCreate"); } @Override public void onStart(Intent intent, int startId) { // TODO Auto-generated method stub super.onStart(intent, startId); if (this.isRunning == false) { updater.start(); this.isRunning = true; } Log.d(TAG, "onStart"); } @Override public synchronized void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if (this.isRunning) { updater.interrupt(); } updater = null; Log.d(TAG, "onDestroy"); } class Updater extends Thread { static final long DELAY = 10000; private boolean isRunning = false; public Updater() { super("Updater"); } @Override public void run() { // TODO Auto-generated method stub super.run(); isRunning = true; while (isRunning) { try { // Do something startService(new Intent(getBaseContext(), StartServiceTwo.class)); Log.d(TAG, "Updater running"); Thread.sleep(DELAY); } catch (InterruptedException e) { // interrupted isRunning = false; } } // while } public boolean isRunning() { return this.isRunning(); } } } I have gone through all the brackets and I can't find anyone that isn't where it's supposed to be.
Edit:
Still the error:
package com.iggeman.updater; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; public class UpdaterService extends Service { private static final String TAG = UpdaterService.class .getSimpleName(); private Updater updater; public boolean isRunning = false; @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); updater = new Updater(); Log.d(TAG, "onCreate"); } @Override public void onStart(Intent intent, int startId) { // TODO Auto-generated method stub super.onStart(intent, startId); if (this.isRunning == false) { updater.start(); this.isRunning = true; } Log.d(TAG, "onStart"); } @Override public synchronized void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if (this.isRunning) { updater.interrupt(); } updater = null; Log.d(TAG, "onDestroy"); } class Updater extends Thread { static final long DELAY = 10000; private boolean isRunning = false; public Updater() { super("Updater"); } @Override public void run() { // TODO Auto-generated method stub super.run(); isRunning = true; while (isRunning) { try { // Do something startService(new Intent(getBaseContext(), StartServiceTwo.class)); Log.d(TAG, "Updater running"); Thread.sleep(DELAY); } catch (InterruptedException e) { // interrupted isRunning = false; } } // while } //Run } //Class updater public boolean isRunning() { return this.isRunning(); } } //Main body