title: How do I get my progress bar to 'progress' with a button click?
body: <p>I am trying to create a button that when clicked it will make the progress bar increase.</p>
  
  <p>I have set the bar to a maximum of 100 and every time the button is selected, I'm hoping it will go up by 1/10.</p>
  
  <p>Anyone able to help with this? My progress bar is just called 'progressBar'.</p>
  
  <pre><code>&lt;ProgressBar
      android:progressDrawable="@android:drawable/progress_horizontal"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/progressBar"
      style="?android:attr/progressBarStyleHorizontal"
      android:layout_above="@+id/imageView36"
      android:max="100"
      android:progress="10"
      android:layout_alignEnd="@+id/btnGenerate"
      android:layout_alignStart="@+id/btnGenerate" /&gt;
  
  
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_squiz);
  
      /*Button button =
              (Button) findViewById(R.id.btnGenerate);
      MyOnClickListener Listener =
              new MyOnClickListener();
      button.setOnClickListener((View.OnClickListener) Listener);*/
  
  
      //btnGenerate = (Button) findViewById(R.id.btnGenerate);
      //btnGenerate.setOnClickListener(btnGenerateListener);
      TextView ABshow = (TextView) findViewById(R.id.ABNumber);
      TextView BCshow = (TextView) findViewById(R.id.BCNumber);
      TextView Ashow = (TextView) findViewById(R.id.ANumber);
      // btnRand.setOnClickListener(btnRandListener);
      Random rnd = new Random();
      int ABrandomNumber = rnd.nextInt(34) + 5; //random number between 5 and 39
      //Toast.makeText(SineQuiz.this, "Rand num: " + String.valueOf(ABrandomNumber), Toast.LENGTH_SHORT).show();
      ABshow.setText("" + String.valueOf(ABrandomNumber));
      int BCrandomNumber = rnd.nextInt(20) + 5; //random number between 5 and 25
      //Toast.makeText(SineQuiz.this, "Rand num: " + String.valueOf(BCrandomNumber), Toast.LENGTH_SHORT).show();
      BCshow.setText("" + String.valueOf(BCrandomNumber));
      int ArandomNumber = rnd.nextInt(25) + 5; //random number between 5 and 30
      //Toast.makeText(SineQuiz.this, "Rand num: " + String.valueOf(ArandomNumber), Toast.LENGTH_SHORT).show();
      Ashow.setText("" + String.valueOf(ArandomNumber));
  
     /* button.setOnClickListener(
              new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
  
                      progressBar.setProgress(progressBar.getProgress() + 10);
                  }
              });*/
  
  
  }
  
  
  
  public void setBtnGenerateListener (View view) {
      progressBar.setProgress(progressBar.getProgress() + 10);}
  /*public View.OnClickListener btnGenerateListener = new View.OnClickListener() {
      @Override
  
      public void onClick(View v) {
          progressBar.setProgress(progressBar.getProgress() + 10);
      }
  };*/
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.menu_sine_quiz, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
  
      //noinspection SimplifiableIfStatement
      if (id == R.id.action_settings) {
          return true;
      }
  
      return super.onOptionsItemSelected(item);
  
  }
  </code></pre>
  
  <p>Sorry I don't know if the code is much help! And ideally, if this button could also generate the random numbers I have above that would be a bonus!</p>