1

I want to use this answer in Kotlin: https://stackoverflow.com/a/30337653/12478830

It works correctly for me but I get this warning 'onPrepareOptionsPanel(View?, Menu): Boolean' is deprecated. Deprecated in Java. What should I use instead of it?

MMG
  • 3,226
  • 5
  • 16
  • 43

1 Answers1

1

From the Android source code:

/**
 * @hide
 * @deprecated Override {@link #onPreparePanel(int, View, Menu)}.
 */
@SuppressWarnings("DeprecatedIsStillUsed")
@RestrictTo(LIBRARY_GROUP_PREFIX)
@Deprecated
protected boolean onPrepareOptionsPanel(@Nullable View view, @NonNull Menu menu) {
    return super.onPreparePanel(Window.FEATURE_OPTIONS_PANEL, view, menu);
}

In other words you should use Activity.onPreparePanel(int, View, Menu).

Nicolas
  • 6,611
  • 3
  • 29
  • 73