I'm developing an Android application where I have entities A and sub-entities B. An A can have multiple Bs associated with it. (There's a database check for referential integrity).

I'm planning to implement a delete Action bar button with a trash icon. Bear in mind that checking for relationships may take time (asynchronously). Which of the following flows (or anything you can think of) would be better?

  1. Post-confirm error checking

    a) User clicks the delete button

    b) User is asked if (s)he wants to delete the A (yes/no confirm)

    c) App displays: Sorry, can't delete A, it still has Bs associated to it
    (implying that (s)he has to delete all Bs first, but no shortcut to that)

  2. Pre-confirm error checking

    a) User clicks the delete button

    b) App displays: Sorry, can't delete A, it still has Bs associated to it
    (implying that (s)he has to delete all Bs first, but no shortcut to that)

  3. Pre-click error checking

    a) User can't click the delete button it's not shown or disabled
    (how would (s)he tell why it's not there?)

  4. Post double-confirm

    a) User clicks the delete button

    b) User is asked if (s)he wants to delete (yes/no confirm)

    c) App displays: Sorry, can't delete A, it still has Bs associated to it, do you want to delete these Bs as well?

  5. Flexible confirmation

    a) User clicks the delete button
    Optionally: the delete icon changes based on any Bs associated to the current A

    b) User is asked if (s)he wants to delete A and all Bs associated with it (yes/no confirm)
    Optionally: the all Bs associated with it part only shows if there are any.

3 Answers 3


Suggestion #5 sort of defeats the question.

If it's possible to delete "daughter" (don't know if this is proper lingo) Bs along with "parent" A, why not always suggest that?

On the confirmation dialog, alert that the current action will result in multiple entities (A and Bs) being deleted (list daughter Bs if possible) and confirm to delete the entire branch.

  • In programming it's always parent-child even if it's a box with stuff in it.
    – TWiStErRob
    Dec 4, 2014 at 11:50
  • I went with #5 in the end, my biggest problem was "checking for relationships may take time (asynchronously)", but in the end it turned out to be pretty fast. I just thought about moving it even further: displaying a dialog showing that the whole branch may be removed without any checks, displaying a loading icon, then starting the checking in the background. Once the check finished update the dialog to display the children or "doesn't have children, safe to remove".
    – TWiStErRob
    Dec 4, 2014 at 11:53
  • Try to look for questions about agreeable 'loading' times. I guess your thinking of this 'May remove entire branch' warning to keep users who would cancel the deletion from waiting. If the wait time is usually agreeable it might not be necessary.
    – Navot
    Dec 4, 2014 at 13:31
  • Currently it's the internal DB which is fast, but later if I move to the cloud, the 3G/H+ times to check for children may be dead slow and forcing users to wait for response is not nice, especially if they understand the consequences and want to proceed regardless. They'll have to wait for the deletion anyway...
    – TWiStErRob
    Dec 4, 2014 at 13:39
  • 1
    In that case I agree giving the user a way out if they don't need to wait is best. Wording it as a tip instead of a warning is nicer, I think.
    – Navot
    Dec 4, 2014 at 13:44

I would have the Delete button open a dialog box (modal window) that has a confirm message (if Delete is enabled) or a 'Sorry but you cannot delete this' message (if Delete is disabled).

Disabling the button is also a good choice, you could communicate why it's disabled with a tooltip on hover. Didn't notice OP is discussing an Android application.

  • Tooltips are always good, but hover is hard in Android; Samsung Galaxy S4 supports it, but my previous 4 Androids didn't.
    – TWiStErRob
    Jul 29, 2014 at 18:15

N.B.: I'm assuming this app is backed up by a database on a server. If it's not, please read 'server-side script' as 'separate process' or 'other method' as appropriate.

What you're going to need here is a mixture. I recommend methods 3 and 4 that you already have. I don't know how you're displaying the entities but I'm going to assume it's in a list with select checkboxes next to each entry.


  • When a checkbox is selected, you call a method to check for sub-entities. You save the result. Of course, if the user deslects the checkbox you can cancel the check. This means that when you want to know about sub-entities, it's all already there, no further checking is necessary.
  • When the delete button is clicked, this calls a server-side script. This pops the confirm dialog, which has a message according to the sub-entity state, as below. This then implements the action selected by the user (usually OK or Cancel but may be 'delete B then A' as below)


The confirm dialog should be flexible. It should ask the user whether she wants to delete the entity; if it has sub-entities, it should say it can't delete A but does she want to delete Bs then A?

You could still disable the delete button if you do your pre-click checking as described here. However, if you do, on tap it should display a tooltip that explains briefly why it is disabled, such as "The selected entity/entities have still got sub-entities and cannot be deleted.'

Hope this helps.

  • These are good tips for a desktop web application, but sadly most of it does not apply to Android.
    – TWiStErRob
    Jul 29, 2014 at 18:36
  • You have a point. Sorry, I was thinking of a web app (though much of this still applies) - I'll edit it.
    – ArtOfCode
    Jul 29, 2014 at 19:14
  • Also the display is containing a screen of A's details, so there's a current selection, no checkboxes.
    – TWiStErRob
    Jul 29, 2014 at 19:21
  • Even simpler then. You can use the pre-click checking as described, but move the execution to when the screen first loads rather than on select.
    – ArtOfCode
    Jul 29, 2014 at 19:24
  • Edited. Should be OK for android now.
    – ArtOfCode
    Jul 29, 2014 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.