[Solved] Get string line by line android programmatically


I think you can go for an approach like this.

    int clicks = 0;
    Button checkButton = (Button) findViewById(R.id.check_Button);
    checkButton.setOnClickListener(new View.OnClickListener() {
         public void onClick(View v) {
         EditText editBox = (EditText) findViewById(R.id.edit_Text);
         String items = editBox.getText().toString();
         if (i == 0) {  
            Toast.makeText(getApplicationContext(), items , Toast.LENGTH_LONG).show();  
            i++;  
            editBox.setText("");
         } else if (i == 1) {  
           Toast.makeText(getApplicationContext(), items , Toast.LENGTH_LONG).show();  
           i++; 
           editBox.setText("");
         } else if (i==2) {
           Toast.makeText(getApplicationContext(), items , Toast.LENGTH_LONG).show();  
           i = 0;
         }  
  } 
    
}

Just enter a value in the editText when the value is reset after a single button click.

solved Get string line by line android programmatically