OSDN Git Service

Check if actionbar exists at ActionBarUtils.getActionBar().
authorAhbong Chang <cwahbong@google.com>
Thu, 16 Aug 2012 06:04:40 +0000 (14:04 +0800)
committerAhbong Chang <cwahbong@google.com>
Thu, 16 Aug 2012 06:51:01 +0000 (14:51 +0800)
Bug: 6927267
Change-Id: I85645f25879ced48a85a2bef4f55f1c34b8806ec

src/com/android/gallery3d/actionbar/ActionBarUtils.java

index 25ccb92..4df8d5c 100644 (file)
@@ -23,9 +23,12 @@ import com.android.gallery3d.common.ApiHelper;
 public class ActionBarUtils {
 
     public static ActionBarInterface getActionBar(Activity activity) {
-        return ApiHelper.HAS_ACTION_BAR
-                ? new SystemActionBarWrapper(activity)
-                : new SimpleActionBar(activity);
+        if (ApiHelper.HAS_ACTION_BAR) {
+            if (activity.getActionBar() == null) return null;
+            return new SystemActionBarWrapper(activity);
+        } else {
+            return new SimpleActionBar(activity);
+        }
     }
 
     public static ActionModeInterface startActionMode(