The request codes you are using to denote call to Activity B are mis-matching here. The one you have put to start the Activity B is 2
startActivityForResult(i,2);
and then in onActivityResult you check,
if(requestCode==100){ .. }
hence the issue. Change it to,
if(requestCode==2){ .. }
and it shall work. :)
Edit -
Change Intent i = new Intent(ChangePwd.this,MainActivity.class);
to
Intent i = new Intent();