如何查看过时方法的新实现(标签-Android)

Android Studio如何查看过时方法的新实现

Android Studio方法过时,如何找到过时方法的新实现?

如果是Android 系统添加了@Deprecated 过时注解的api。会在api注释里面。告诉调用者如何去关联替代旧api的新api,例如:

 /**
     * Support library version of {@link Activity#invalidateOptionsMenu}.
     *
     * <p>Invalidate the activity's options menu. This will cause relevant presentations
     * of the menu to fully update via calls to onCreateOptionsMenu and
     * onPrepareOptionsMenu the next time the menu is requested.
     *
     * @deprecated Call {@link Activity#invalidateOptionsMenu} directly.
     */
    @SuppressWarnings("DeprecatedIsStillUsed")
    @Deprecated
    public void supportInvalidateOptionsMenu() {
        invalidateOptionsMenu();
    }

会告诉使用者,要用 @deprecated Call {@link Activity#invalidateOptionsMenu} directly. 替代 supportInvalidateOptionsMenu()

一般注释里会写,如果注释里没写,那官网应该有说明
如果官网也没有,那百度吧