Skip to content

Instantly share code, notes, and snippets.

@smaspe
Last active December 18, 2015 07:58
Show Gist options
  • Save smaspe/5750100 to your computer and use it in GitHub Desktop.
Save smaspe/5750100 to your computer and use it in GitHub Desktop.
public abstract class LoginableActivity extends Activity {
private static final int LOGIN = 42;
public static boolean loggedIn = false;
public void login(View target) {
startActivityForResult(new Intent(this, LoginActivity.class), LOGIN);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == LOGIN) {
if (resultCode == RESULT_OK) {
loggedIn = true;
} else {
loggedIn = false;
}
// ...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment