OmniGears: fix resource access from event service settings

Change-Id: I29b1a7b18fd8fce740c613a88fb626965c7452a3
diff --git a/src/org/omnirom/omnigears/service/EventServiceSettings.java b/src/org/omnirom/omnigears/service/EventServiceSettings.java
index ffabedb..d29b9ce 100644
--- a/src/org/omnirom/omnigears/service/EventServiceSettings.java
+++ b/src/org/omnirom/omnigears/service/EventServiceSettings.java
@@ -61,6 +61,8 @@
     private SwitchPreference mEnable;
     private SwitchPreference mAutoStart;
     private Handler mHandler = new Handler();
+    private String mServiceRunning;
+    private String mServiceStopped;
 
     @Override
     public int getMetricsCategory() {
@@ -79,8 +81,9 @@
         mEnable = (SwitchPreference) findPreference(EVENT_SERVICE_ENABLED);
         mEnable.setChecked(getPrefs().getBoolean(EventServiceSettings.EVENT_SERVICE_ENABLED, false));
         mEnable.setOnPreferenceChangeListener(this);
-        mEnable.setSummary(isServiceRunning() ? getResources().getString(R.string.event_service_running)
-                : getResources().getString(R.string.event_service_stopped));
+        mServiceRunning = getResources().getString(R.string.event_service_running);
+        mServiceStopped = getResources().getString(R.string.event_service_stopped);
+        mEnable.setSummary(isServiceRunning() ? mServiceRunning : mServiceStopped);
 
         mAutoStart = (SwitchPreference) findPreference(EVENT_MEDIA_PLAYER_START);
         mAutoStart.setChecked(getPrefs().getBoolean(EventServiceSettings.EVENT_MEDIA_PLAYER_START, false));
@@ -121,8 +124,10 @@
             mHandler.postDelayed(new Runnable() {
                 @Override
                 public void run() {
-                    mEnable.setSummary(isServiceRunning() ? getResources().getString(R.string.event_service_running)
-                            : getResources().getString(R.string.event_service_stopped));
+                    try {
+                        mEnable.setSummary(isServiceRunning() ? mServiceRunning : mServiceStopped);
+                    } catch (Exception e) {
+                    }
                 }
             }, 1000);
             return true;