Back to project page ribbit.
The source code is released under:
MIT License
If you think the Android project ribbit 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.lleshiart.ribbit; // w w w. jav a2 s. c o m import android.app.Activity; import android.app.AlertDialog; import android.os.Bundle; 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.RequestPasswordResetCallback; public class ForgotPasswordActivity extends Activity { public static final String TAG = ForgotPasswordActivity.class.getSimpleName(); protected EditText mForgotPasswordText; protected Button mForgotPasswordButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_forgot_password); mForgotPasswordText = (EditText) findViewById(R.id.resetEmailField); mForgotPasswordButton = (Button)findViewById(R.id.forgotPasswordButton); mForgotPasswordButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String email = mForgotPasswordText.getText().toString(); email = email.trim(); if (email.isEmpty()) { AlertDialog.Builder builder = new AlertDialog.Builder(ForgotPasswordActivity.this); builder.setTitle(R.string.forgot_password_error_title) .setMessage(R.string.forgot_password_error_message) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } else { // Reset Password setProgressBarIndeterminateVisibility(true); ParseUser.requestPasswordResetInBackground(email, new RequestPasswordResetCallback() { @Override public void done(ParseException e) { setProgressBarIndeterminateVisibility(false); if (e == null) { // Email was sent AlertDialog.Builder builder = new AlertDialog.Builder(ForgotPasswordActivity.this); builder.setTitle(R.string.forgot_password_success_title) .setMessage(R.string.forgot_password_success_message) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } else { // Something went wrong AlertDialog.Builder builder = new AlertDialog.Builder(ForgotPasswordActivity.this); builder.setTitle(R.string.forgot_password_error_title) .setMessage(e.getMessage()) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } } }); } } }); } }