I have an activity with a list view and a common header with hidden icon.. when I click the listview a loginscreen will be triggered and when the login is successfull it should come back to previous activity with icon visible on header. I'm using a static image initially to hide the icon when the user comes to that particular screen. below is my login code
public void onClick(View v) {
String password = etPassword.getText().toString();
Intent returnIntent = new Intent();
if(password.equals("guest")){
returnIntent.putExtra("result", true);
setResult(RESULT_OK, returnIntent);
}
else {
returnIntent.putExtra("result", false);
setResult(RESULT_OK, returnIntent);
}
finish();
}
below is my onActivityResult()
code
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
boolean success = data.getBooleanExtra("result", false);
if(success) {
sImg.setVisibility(View.VISIBLE);
}
else {
sImg.setVisibility(View.INVISIBLE);
}
}
sImg
is a static image. Above code seems ok for me but not working.