From 43406ebe776517711cd8f18f615cc93920149548 Mon Sep 17 00:00:00 2001 From: Milk <1871357815@qq.com> Date: Wed, 16 Feb 2022 15:50:06 +0800 Subject: [PATCH] Update SecondActivity.java --- .../main/java/top/niunaijun/app/SecondActivity.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/top/niunaijun/app/SecondActivity.java b/app/src/main/java/top/niunaijun/app/SecondActivity.java index a47a111..7910d8a 100644 --- a/app/src/main/java/top/niunaijun/app/SecondActivity.java +++ b/app/src/main/java/top/niunaijun/app/SecondActivity.java @@ -1,6 +1,7 @@ package top.niunaijun.app; import android.os.Bundle; +import android.util.Log; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; @@ -24,13 +25,7 @@ public class SecondActivity extends AppCompatActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - SecondActivity activity = SecondActivity.this; - ActionBar supportActionBar = BRAppCompatActivity.get(activity).getSupportActionBar(); - try { - Method getSupportActionBar = AppCompatActivity.class.getDeclaredMethod("getSupportActionBar"); - getSupportActionBar.setAccessible(true); - } catch (Throwable e) { - e.printStackTrace(); - } + ActionBar supportActionBar = BRAppCompatActivity.get(this).getSupportActionBar(); + Log.d("SecondActivity", "supportActionBar: " + supportActionBar); } }