I have two classes Class "A" and Class "B". In class A i have declared a String password ="admin" .Now in class B i am taking value from user and i want to change that value of string in class A and want to store value that user entered. How can i do that? Any help please?
class A
forgetpassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent j = new Intent(MainActivity.this,newpassword.class);
startActivity(j);
Class B
EditText newpassword;
Button change;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_password);
newpassword = (EditText)findViewById(R.id.newpassword);
change = (Button)findViewById(R.id.chnage);
change.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MainActivity.b= newpassword.getText().toString();
Intent y= new Intent(NewPassword.this,MainActivity.class);
startActivity(y);
}
});