Fix some errors in the foreground compat

The foreground compatibility sample wouldn't actually work on an old
platform because of a misplaced return statement in onCreate and the
invokeMethod would ignore its arguments.

Change-Id: Ic1d1a6d8579700215c7988cd603a6bb86f1346a4
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java b/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
index 9f84be1..123e369 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
@@ -66,7 +66,7 @@
     
     void invokeMethod(Method method, Object[] args) {
         try {
-            mStartForeground.invoke(this, mStartForegroundArgs);
+            method.invoke(this, args);
         } catch (InvocationTargetException e) {
             // Should not happen.
             Log.w("ApiDemos", "Unable to invoke method", e);
@@ -103,15 +103,7 @@
         // If we have the new stopForeground API, then use it.
         if (mStopForeground != null) {
             mStopForegroundArgs[0] = Boolean.TRUE;
-            try {
-                mStopForeground.invoke(this, mStopForegroundArgs);
-            } catch (InvocationTargetException e) {
-                // Should not happen.
-                Log.w("ApiDemos", "Unable to invoke stopForeground", e);
-            } catch (IllegalAccessException e) {
-                // Should not happen.
-                Log.w("ApiDemos", "Unable to invoke stopForeground", e);
-            }
+            invokeMethod(mStopForeground, mStopForegroundArgs);
             return;
         }
         
@@ -130,10 +122,10 @@
                     mStartForegroundSignature);
             mStopForeground = getClass().getMethod("stopForeground",
                     mStopForegroundSignature);
+            return;
         } catch (NoSuchMethodException e) {
             // Running on an older platform.
             mStartForeground = mStopForeground = null;
-            return;
         }
         try {
             mSetForeground = getClass().getMethod("setForeground",