title: Using getIntent() in onCreate() prevents ui from loading... why?
body: <p>I have an activity that list authorized users, and I'm using <code>getIntent()</code> in my activity's <code>onCreate()</code> method to check if the activity should display a pre-filled add user dialog when it loads. Here is my code:</p>
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_sms_auth_manager);
      
      try{ //check if the activity was launched with a prefill intent
          Intent intent = getIntent();
          int id = (intent.getIntExtra(&quot;notification_id&quot;,0));
          NotificationUtils notificationUtils = new NotificationUtils();
          notificationUtils.hideNotification(this,id);
          if (intent.getBooleanExtra(&quot;isPrefill&quot;,false)){
              String preFill = intent.getStringExtra(&quot;sender&quot;);
              showAddUserDialog(preFill);
          }
      }catch (Exception ignore){} //exception swallowed means no dialog
      
      refreshList(); //loads the list of users into the main listview of the activity
  
  }
  </code></pre>
  <p>My problem is that the call to <code>refreshList()</code> is not resulting in the list being refreshed. I tried putting it before the try block as well, and either way it won't work. I tested with the try block commented out though, and that does work, but then I lose the functionality.</p>
  <p>Here is the code of the <code>refreshList()</code> method, in case it's necessary:</p>
  <pre><code>private void refreshList(){
      SharedPreferences sharedPrefs = getSharedPreferences(&quot;users&quot;,0);
  
      LinearLayout ll = findViewById(R.id.ll);
      
      ll.removeAllViews();
      
      LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
          ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT
      );
      
      
      for (String sender : sharedPrefs.getAll().keySet()) {
          CheckBox checkBox = new CheckBox(this);
          checkBox.setText(getContactDisplayName(sender));
      
          checkBox.setTag(sender);
          
          try{
              checkBox.setChecked(sharedPrefs.getBoolean(sender,false));
          }catch (Exception e){
              checkBox.setChecked(false);
          }
          
          checkBox.setLayoutParams(layoutParams);
          checkBox.setOnClickListener(v -&gt; {
              try {
                  sharedPrefs.edit().putBoolean(sender, checkBox.isChecked()).apply();
              }catch (Exception e){
                  Toast.makeText(this, &quot;Preference not updated.\n&quot;+e.getMessage(),
                      Toast.LENGTH_SHORT).show();
              }
          });
          checkBox.setOnLongClickListener(v -&gt; {
              showPopupMenu(v);
              return false;
          });
          ll.addView(checkBox);
      }
  }
  </code></pre>
  <p>Why does the try block prevent the UI from refreshing, and how can I acheive the functionality I am looking for?</p>