Skip to content

Commit

Permalink
Merge pull request #2998 from hieupham007/timob-10993
Browse files Browse the repository at this point in the history
timob-10993: Fix crashing issue when targetSdkVersion is 11+
  • Loading branch information
ayeung committed Sep 29, 2012
2 parents 398bba4 + a4d7a26 commit b66de42
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ protected void onCreate(Bundle savedInstanceState)

// create the activity proxy here so that it is accessible from the activity in all cases
activityProxy = new ActivityProxy(this);


// Increment the reference count so we correctly clean up when all of our activities have been destroyed
KrollRuntime.incrementActivityRefCount();
Expand Down Expand Up @@ -730,6 +731,14 @@ public boolean dispatchKeyEvent(KeyEvent event)
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// If targetSdkVersion is set to 11+, Android will invoke this function
// to initialize the menu (since it's part of the action bar). Due
// to the fix for Android bug 2373, activityProxy won't be initialized b/c the
// activity is expected to restart, so we will ignore it.
if (activityProxy == null) {
return false;
}

if (menuHelper == null) {
menuHelper = new TiMenuSupport(activityProxy);
}
Expand Down

0 comments on commit b66de42

Please sign in to comment.