Skip to content

Instantly share code, notes, and snippets.

@smaspe
Created June 10, 2013 16:42
Show Gist options
  • Save smaspe/5750268 to your computer and use it in GitHub Desktop.
Save smaspe/5750268 to your computer and use it in GitHub Desktop.
public class LoginActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
public void login(View target) {
// 30% chances to be logged in !
// Replace with your login test (!)
if (new Random().nextInt(100) < 30) {
setResult(RESULT_OK);
finish();
} else {
Toast.makeText(this, "Login failed, please try again", Toast.LENGTH_SHORT).show();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment