Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 :)