Back to project page Ribbit-Login-.
The source code is released under:
Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECI...
If you think the Android project Ribbit-Login- listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.sabersoft.ribbit; //w w w. j a v a 2 s. c o m import android.app.Activity; import android.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.EditText; import com.parse.ParseException; import com.parse.ParseUser; import com.parse.SignUpCallback; public class SignUpActivity extends Activity { protected EditText mUserName; protected EditText mPassword; protected EditText mEmail ; protected Button mSignUpButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_sign_up); mUserName = (EditText)findViewById(R.id.usernameField1); mPassword = (EditText)findViewById(R.id.passwordField1); mEmail = (EditText)findViewById(R.id.emailField1); mSignUpButton = (Button)findViewById(R.id.signUpButton); mSignUpButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String username = mUserName.getText().toString(); String password = mPassword.getText().toString(); String email = mEmail.getText().toString(); username = username.trim(); password = password.trim(); email = email.trim(); if (username.isEmpty() || password.isEmpty() || email.isEmpty()) { AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this); builder.setMessage(R.string.sign_up_error) .setTitle(R.string.sign_up_error_title) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } else { setProgressBarIndeterminateVisibility(true); ParseUser newUser = new ParseUser(); newUser.setUsername(username); newUser.setPassword(password); newUser.setEmail(email); newUser.signUpInBackground(new SignUpCallback() { @Override public void done(ParseException e) { // TODO Auto-generated method stub setProgressBarIndeterminateVisibility(false); if (e == null){ Intent intent = new Intent(SignUpActivity.this, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } else { AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this); builder.setMessage(R.string.sign_up_error_email) .setTitle(R.string.sign_up_error_title) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } } }); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.sign_up, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }