Last active
December 18, 2015 07:58
-
-
Save smaspe/5750100 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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