Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. public class LoginActivity extends ActionBarActivity {
  2. Button loginButton;
  3.  
  4. String txtUsername;
  5. String txtPassword;
  6. EditText password;
  7. EditText username;
  8.  
  9. @Override
  10. protected void onCreate(Bundle saveInstanceState) {
  11. super.onCreate(saveInstanceState);
  12. setContentView(R.layout.activity_login);
  13.  
  14. loginButton = (Button) findViewById(R.id.login);
  15.  
  16. loginButton.setOnClickListener(new View.OnClickListener() {
  17. @Override
  18. public void onClick(View v) {
  19. txtUsername = username.getText().toString();
  20. txtPassword = password.getText().toString();
  21.  
  22. ParseUser.logInInBackground(txtUsername, txtPassword, new LogInCallback() {
  23. @Override
  24. public void done(ParseUser user, ParseException e) {
  25. if (user != null) {
  26. Intent intent = new Intent(LoginActivity.this, Welcome.class);
  27. startActivity(intent);
  28. finish();
  29. } else {
  30. Toast.makeText(getApplicationContext(), "This user does not exist! Please Sign up", Toast.LENGTH_SHORT).show();
  31. }
  32. }
  33. });
  34. }
  35. });
  36. }
  37.  
  38. public class ParseConnector extends MultiDexApplication {
  39.  
  40. @Override
  41. public void onCreate(){
  42. super.onCreate();
  43.  
  44. Parse.initialize(this, "ZzfoJHON4Gc******2YlIhOFT3Tk8GOoANeO", "9ikHKNBO6BfmNRMauxckoB******ZzxlBPYDL");
  45. ParseInstallation.getCurrentInstallation().saveInBackground();
  46. ParseUser.enableAutomaticUser();
  47. ParseACL defaultACL = new ParseACL();
  48. defaultACL.setPublicReadAccess(true);
  49. ParseACL.setDefaultACL(defaultACL, true);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement