title: crash on MainMenu.onCreateOptionsMenu
body: <p>When I test my app on Xiaomi A2, it runs fine. When I upload to Google Play, it crashes.
  Stack Trace on Play console reads:</p>
  <pre><code>java.lang.NullPointerException: 
    at com.thongjoon.ocsc_exam_prep.MainMenu.onCreateOptionsMenu (MainMenu.java:29)
    at android.app.Activity.onCreatePanelMenu (Activity.java:4140)
    at androidx.fragment.app.FragmentActivity.onCreatePanelMenu (FragmentActivity.java:2) ...
  </code></pre>
  <p>This happens after I migrate to AndroidX.</p>
  <p>Here is my onCreateOptionsMenu</p>
  <pre><code>public boolean onCreateOptionsMenu(Menu menu) {
          
          getMenuInflater().inflate(R.menu.menu_welcome, menu);
          MenuItem item = menu.findItem(R.id.action_share);
          mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
          mShareActionProvider.setShareIntent(getDefaultShareIntent());
  
         String isAvailable = getApplicationContext().getResources().getString(R.string.is_show_order);
  
          MenuItem buyItem = menu.findItem(R.id.action_buy_sheets);
        //  if (isAvailable!=null) {
              if (!isAvailable.equals(&quot;yes&quot;)) {
                  buyItem.setVisible(false);
              } else {
                  buyItem.setVisible(true);
              }
      //    }
  
          return true;
      }
  </code></pre>
  <p>and</p>
  <pre><code> @Override
      public boolean onOptionsItemSelected(MenuItem item) {
         int id = item.getItemId();
  ...
         if (id == R.id.action_buy_sheets) {
              startActivity(new Intent(Intent.ACTION_VIEW, 
  Uri.parse(&quot;https://forms.gle/1PYvktbuGPM3MScZ9&quot;)));
              return true;
          }
  ...
  }
  </code></pre>
  <p>in build.gradle</p>
  <pre><code>...
  dependencies {
      implementation fileTree(include: ['*jar'], dir: 'libs')
      testImplementation 'junit:junit:4.12'
      implementation 'androidx.appcompat:appcompat:1.0.2'
      implementation 'com.google.android.material:material:1.0.0'
  
  }
  ...
  </code></pre>
  <p>I use Analyze&gt;Inspect Code to find error. No error reported.
  I am new. This app is my first app.
  Please help. Very much appreciated.</p>