Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Android: How to show successful message(dialog) when user sends email address by clicking on "Forgot Password? link (Extra Credit)

// get user input

                        String result = userInputEmail.getText().toString();
                        ParseUser.requestPasswordResetInBackground(result, new RequestPasswordResetCallback() {

                            @Override
                            public void done(ParseException e) {
                                if(e == null){
                                    //success!
                                    AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
                                    builder.setMessage(R.string.forget_password_emailsent_message)
                                    .setTitle(R.string.forget_password_emailsent_title)
                                    .setPositiveButton(android.R.string.ok, null);
                                    AlertDialog dialog = builder.create();
                                    dialog.show();
                                }
                                else{
                                    AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
                                    builder.setMessage(e.getMessage())
                                    .setTitle(R.string.forgot_password_error_message)
                                    .setPositiveButton(android.R.string.ok, null);
                                    AlertDialog dialog = builder.create();
                                    dialog.show();

                                }

                            }

2 Answers

Hi Nidhi,

What is the question? I don't think this is the place to submit your code for the extra credit, even though I haven't tried to get code for extra credit before. If you find out how, please post it here.

Thanks

Hi Nidhi,

The code looks correct assuming that your "forget_password_emailsent_message" and "forget_password_emailsent_title" strings are set correctly....how is it behaving? what error are you getting?