title: Slow application. Can someone advice me what to do?
body: <p>My app run little slowly and it becuase I use a lot in AlertDialog box.
  I trying to give the user option to select and I do it with ImageButtns in AlertDialog.
  <a href="https://i.stack.imgur.com/Wsi73.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wsi73.png" alt="enter image description here"></a></p>
  
  <p>its start with 6 ImageButton after he choose one of them he go to another 5 ImageButton based on what he selected, after that 4 ImageButton and go on. Like the picture.
  The app go very slow, can someone advice me what to do?
  Maybe use something else insted Alert Boxses.</p>
  
  <p>The code of the Alerts for only one route Down here:</p>
  
  <pre><code> btnPattern.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              ImageButton mSkirt = dialogAlert(R.layout.activity_pattern_pop_up,R.id.btnSkirt,0);
              mSkirt.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      ImageButton mSkirtStraight = dialogAlert(R.layout.activity_skirt_pop_up,R.id.btnSkirtStraight,1);
                      mSkirtStraight.setOnClickListener(new View.OnClickListener() {
                          @Override
                          public void onClick(View v) {
                              ImageButton mSkirtStraightMini = dialogAlert(R.layout.activity_skirt_straight_pop_up,R.id.btnSkirtStraightMini,2);
                              mSkirtStraightMini.setOnClickListener(new View.OnClickListener() {
                                  @Override
                                  public void onClick(View v) {
                                      ImageButton mSkirtStraightMiniHigh = dialogAlert(R.layout.activity_skirt_straight_mini_pop_up,R.id.btnSkirtStraightMiniHigh,3);
                                      mSkirtStraightMiniHigh.setOnClickListener(new View.OnClickListener() {
                                          @Override
                                          public void onClick(View v) {
                                              photoSorter.addImages(MainActivity.this, id[0]);
                                              photoSorter.addImages(MainActivity.this, id[1]);
                                              for (AlertDialog dialog:dialogPattern)
                                                  dialog.dismiss();
                                          }
                                      });
                                  }
                              });
                          }
                      });
                  }
              });
          }
      });
  </code></pre>
  
  <p>And the function dialogAlert here:</p>
  
  <pre><code>public ImageButton dialogAlert(int layout,int btnImage,int index){
      AlertDialog.Builder mPattern = new AlertDialog.Builder(MainActivity.this);
      View mPatternView = getLayoutInflater().inflate(layout,null);
      ImageButton mSkirt = (ImageButton) mPatternView.findViewById(btnImage);
      mPattern.setView(mPatternView);
      dialogPattern[index] = mPattern.create();
      dialogPattern[index].show();
      return mSkirt;
  }
  </code></pre>