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 Build a Self-Destructing Message Android App Sending Messages Sending the Message

Hashsham Maneri
Hashsham Maneri
6,983 Points

No Indication of message send success or fail in sending message.

Ben Jakuben , After implementing the send method, I tried it out like in the video(halfway through it). I added the code for both the success toast and the failure alert dialog. My app runs however, there is no toast or alert dialog shown after tapping the send button. I checked logcat for errors and there are none. I logged inside the send method and it does log success so I am thoroughly confused. Please Help.

Following is my code for the send method:

protected void send(ParseObject message){ Log.i(Tag, "starting send message"); message.saveInBackground(new SaveCallback() {

        @Override
        public void done(ParseException e) {
        if (e==null) {
            Toast.makeText(RecipientActivity.this, R.string.success_message, Toast.LENGTH_LONG);
            Log.i(Tag, " send message success");
        } else {
            AlertDialog.Builder builder = new AlertDialog.Builder(
                    RecipientActivity.this);
            builder.setMessage(R.string.error_sending_message);
            builder.setPositiveButton(android.R.string.ok, null).setTitle(R.string.error_selecting_file_title);
            AlertDialog dialog = builder.create();
            dialog.show();
            Log.i(Tag, " send fail");
        }   



        }
    });
}

2 Answers

You need .show() at the end of your Toast, I think.

Steve.

Hashsham Maneri
Hashsham Maneri
6,983 Points

Haha silly mistake to make at this stage. Thank you :)