[Solved] Set text on TextView on button click from another class on android


It won’t be possible, you have to pass the value you want to set in text view using intent. You have to use intent and pass the value from one activity and get that value in another activity and than set the value to text view.

Intent intent1 = new Intent(context, your activity name where you want  to send the value);
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent1.putExtra("otp", verificationCode);
context.startActivity(intent1); 

solved Set text on TextView on button click from another class on android