AndInTheClouds / chordreader2

Search for, display, transpose and save chords on your phone, that you get from the interwebs. :notes:
GNU General Public License v3.0
31 stars 8 forks source link

App crashes when toggling "Dark theme" while at the song list or when viewing a song #35

Closed wtimme closed 2 months ago

wtimme commented 1 year ago

Steps to reproduce

  1. Open the app
  2. Tap "Songs"
  3. Switch to Android's Settings app and toggle "Dark theme" (Display > Appearance)
  4. Switch back to Chord Reader 2

Expected behaviour: The song list is visible.

Observed behaviour: The app has crashed.

Logcat output

Process: org.hollowbamboo.chordreader2, PID: 15163
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.hollowbamboo.chordreader2/org.hollowbamboo.chordreader2.MainActivity}: android.view.InflateException: Binary XML file line #18 in org.hollowbamboo.chordreader2:layout/activity_main: Binary XML file line #17 in org.hollowbamboo.chordreader2:layout/content_main: Error inflating class fragment
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
    at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5456)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5362)
    at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: android.view.InflateException: Binary XML file line #18 in org.hollowbamboo.chordreader2:layout/activity_main: Binary XML file line #17 in org.hollowbamboo.chordreader2:layout/content_main: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #17 in org.hollowbamboo.chordreader2:layout/content_main: Error inflating class fragment
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.appcompat.widget.Toolbar.setTitle(java.lang.CharSequence)' on a null object reference
    at org.hollowbamboo.chordreader2.ui.ListFragment.setTitle(ListFragment.java:460)
    at org.hollowbamboo.chordreader2.ui.ListFragment.setUpInstance(ListFragment.java:358)
    at org.hollowbamboo.chordreader2.ui.ListFragment.onCreateView(ListFragment.java:129)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3104)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:524)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1433)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2977)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2888)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3129)
    at androidx.fragment.app.FragmentStateManager.ensureInflatedView(FragmentStateManager.java:394)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:260)
    at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:142)
    at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:136)
    at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:248)
    at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:227)
    at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1067)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1261)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1117)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1261)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1117)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
    at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
    at androidx.databinding.ViewDataBinding.inflateInternal(ViewDataBinding.java:1409)
    at org.hollowbamboo.chordreader2.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:71)
    at org.hollowbamboo.chordreader2.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:57)
    at org.hollowbamboo.chordreader2.MainActivity.onCreate(MainActivity.java:64)
    at android.app.Activity.performCreate(Activity.java:7994)
    at android.app.Activity.performCreate(Activity.java:7978)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
    at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5456)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5362)
    at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
AndInTheClouds commented 2 months ago

Solved