Android Text validation
<p>Hi I am creating a task reminder app.  It works but I would like to create some sort of Toast validation.  For example a user doesn't fill in the title and I'd like an toast saying "title needs to be filled in!" e.t.c
But I'm not sure how to do this.</p>

<p>I am using an EditText widget by the way.</p>

<p>This is one method:</p>

<pre><code>  protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    mDbHelper = new RemindersDbAdapter(this);

    setContentView(R.layout.reminder_edit);

    mCalendar = Calendar.getInstance(); 
    mTitleText = (EditText) findViewById(R.id.title);
    mBodyText = (EditText) findViewById(R.id.body);
    mDateButton = (Button) findViewById(R.id.reminder_date);
    mTimeButton = (Button) findViewById(R.id.reminder_time);

    mConfirmButton = (Button) findViewById(R.id.confirm);

    mRowId = savedInstanceState != null ? savedInstanceState.getLong(RemindersDbAdapter.KEY_ROWID) 
                                        : null;

    registerButtonListenersAndSetDefaultText();
}
</code></pre>

<p>and another:  </p>

<pre><code>private void saveState() {
    String title = mTitleText.getText().toString();
    String body = mBodyText.getText().toString();

    SimpleDateFormat dateTimeFormat = new SimpleDateFormat(DATE_TIME_FORMAT); 
    String reminderDateTime = dateTimeFormat.format(mCalendar.getTime());

    if (mRowId == null) {

        long id = mDbHelper.createReminder(title, body, reminderDateTime);
        if (id &gt; 0) {
            mRowId = id;
        }
    } else {
        mDbHelper.updateReminder(mRowId, title, body, reminderDateTime);
    }

    new ReminderManager(this).setReminder(mRowId, mCalendar); 
}
</code></pre>

<p>Thanks.</p>
