diff options
| author | Cheng Ke <chengke.info@gmail.com> | 2012-03-14 10:58:35 +0800 |
|---|---|---|
| committer | Cheng Ke <chengke.info@gmail.com> | 2012-03-14 10:58:35 +0800 |
| commit | 7ec212f1185e4dd43d765b22d65485d141037ae6 (patch) | |
| tree | 52aaa0684359158e2d712ed849f923fd2d459d5a /samples/ApiDemos/src | |
| parent | 89b7a104d41c1ecbc1319a3d47199d40d56ebc96 (diff) | |
Remove tab only if tab exists.
Prevent crash in ActionBarTabs(ApiDemos).
Change-Id: I1972fc761e8ebf245afb828fe7595bc764eaae56
Diffstat (limited to 'samples/ApiDemos/src')
| -rw-r--r-- | samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java index 11c1bc279..df6752c98 100644 --- a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java +++ b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java @@ -52,7 +52,9 @@ public class ActionBarTabs extends Activity { public void onRemoveTab(View v) { final ActionBar bar = getActionBar(); - bar.removeTabAt(bar.getTabCount() - 1); + if (bar.getTabCount() > 0) { + bar.removeTabAt(bar.getTabCount() - 1); + } } public void onToggleTabs(View v) { |
