title: Pass textview value between activity
body: <p>i have a problem.
  I have 2 textviews that are increased on button click, but i don't know how to pass textview's value to the next activity that also have the same 2 textviews. Like increasing the value by 1 on first activity then on the second activity on the same textview there will be the value 1 and so on...
  I'm trying to pass the textview value to next activity, i tried a few methods with putextra methods, but it didn't worked.
  There is the code </p>
  
  <pre><code>  Button btnIncrement;
  private CheckBox i1, i2, i3;
  public Button bckbutton;
  
  TextView rspCorecte;
  TextView rspGresite;
  
  int counterCorecte=0;
  int counterGresite=0;
  
  
  
  
  private void initialStates(Intent intent) {
      i1=findViewById(R.id.q1_1);
      i2=findViewById(R.id.q1_2);
      i3=findViewById(R.id.q1_3);
  }
  </code></pre>
  
  <p>Then...</p>
  
  <pre><code>   @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.intrebarea_1);
      initialStates(getIntent());
  
      final AlertDialog.Builder alert2=new AlertDialog.Builder(Intrebarea1.this);
      LayoutInflater factry=LayoutInflater.from(Intrebarea1.this);
      final View view2=factry.inflate(R.layout.raspuns_corect, null);
      alert2.setView(view2);
      alert2.setPositiveButton("", new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialogInterface, int i) {
               finish();
          }
      });
  
  
      final AlertDialog.Builder alertadd = new AlertDialog.Builder(Intrebarea1.this);
      LayoutInflater factory = LayoutInflater.from(Intrebarea1.this);
      final View view = factory.inflate(R.layout.raspuns1, null);
      alertadd.setView(view);
      alertadd.setPositiveButton("", new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dlg, int sumthin) {
              startActivity(new  Intent(Intrebarea1.this,Intrebarea2.class));
              finish();
          }
      });
  
      // SEMNUL INTREBARII
      //reference of button added in the main layout
      final Button raspuns = findViewById(R.id.arataraspuns);
      //setting click event listener to button
      raspuns.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              AlertDialog.Builder builder = new AlertDialog.Builder(Intrebarea1.this);
              View view = LayoutInflater.from(Intrebarea1.this).inflate(R.layout.raspuns1, null);
  
              builder.setView(view);
              builder.show();
  
          }
      });
  
  
      bckbutton=(Button) findViewById(R.id.backbutton);
      bckbutton.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {
      onBackPressed();
  }
  </code></pre>
  
  <p>});</p>
  
  <pre><code>    btnIncrement=findViewById(R.id.btnIncrement);
  
      rspCorecte=findViewById(R.id.rspCorecte);
      rspGresite=findViewById(R.id.rspGresite);
  
      btnIncrement.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
  
           if(i1.isChecked() &amp;&amp; !i2.isChecked() &amp;&amp; !i3.isChecked()){
               alert2.show();
               counterCorecte++;
           }
  
           else if (i1.isChecked() &amp;&amp; i2.isChecked() &amp;&amp; i3.isChecked()){
                  alertadd.show();
               counterGresite++;
              }
  
           else if(i2.isChecked() &amp;&amp; i3.isChecked()){
               alertadd.show();counterGresite++;
           }
  
           else if(i1.isChecked() &amp;&amp; i2.isChecked()){
               alertadd.show();counterGresite++;
           }
  
           else if(i1.isChecked() &amp;&amp; i3.isChecked()){
               alertadd.show();counterGresite++;
           }
  
           else if(i2.isChecked()){
               alertadd.show();counterGresite++;
           }
  
           else if(i3.isChecked()){
               alertadd.show();counterGresite++;
           }
              btnIncrement.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      raspuns.setVisibility(View.VISIBLE);
                      btnIncrement.setVisibility(View.GONE);
                  }
              });
  
              rspCorecte.setText(String.valueOf(counterCorecte));
              rspGresite.setText(String.valueOf(counterGresite));
  
  
          }
      }); }
  
  
      public void bckButton(){
      Intent intent=new Intent(this, AlegeMediulDeInvatare.class);
      startActivity(intent);
      finish();
      }
  
  public void openMainMenu(){
      Intent intent=new Intent(this, MainMenu.class);
      startActivity(intent);
      finish();
  }
  
  public void onBackPressed(){
      AlertDialog.Builder inchiziteoria = new AlertDialog.Builder(Intrebarea1.this, R.style.AlertDialogStyle);
      LayoutInflater inchizi=LayoutInflater.from(Intrebarea1.this);
      View view=inchizi.inflate(R.layout.inchizi_teoria, null);
      inchiziteoria.setView(view);
      // Set the positive button
      inchiziteoria.setPositiveButton("DA", new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
              openMainMenu();
          }
      });
  
      // Set the negative button
      inchiziteoria.setNegativeButton("NU", null);
      // Create the alert dialog
      AlertDialog dialog = inchiziteoria.create();
      // Finally, display the alert dialog
      dialog.show();
      ((Button)dialog.getButton(dialog.BUTTON_POSITIVE)).setTypeface(null, Typeface.BOLD);
      ((Button)dialog.getButton(dialog.BUTTON_NEGATIVE)).setTypeface(null, Typeface.BOLD);
      // Change the alert dialog background color
      dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.WHITE));
  }
     public void openUrmatoarea(View v){
      Intent intent=new Intent(this, Intrebarea2.class);
      startActivity(intent);
      finish();
     }
  </code></pre>
  
  <p>}</p>
  
  <p>Can someone tell me how to pass the textview value to the next activity?
  Thanks in advance.</p>