How to Create an AlertDialog: Gmail: Long Press on Email

This example will create an AlertDialog similar to the Alert Dialog that displays on the Gmail app, Version 2.3.6
This was tested on a: Samsung YP-G0, API Level 10, Version 2.6.35

Long Press options

Long Press continued list of options



How to Get to the Alert Dialog we are creating
Open Gmail App
Select Inbox
Long Press an Email, and the above Alert Dialog will display.

1. To recreate this AlertDialog, Add a Title that displays "Your Email Subject Line Goes Here" * Note: This will actually be linked to the the Subject line of the email you selected, but for now we will add this static text.

2. Add a List of Items to an AlertDialog.Builder, with the CharSequence array of  "Read, Archive, Mute, Mark read, Delete, Add star, Change labels, Report spam, Help".

3. If the email has already been read, this CharSequence named myCharSequence2 should be displayed instead. "Read, Archive, Mute, Mark unread, Delete, Add star, Change labels, Report Spam, Help".

4. Compile and run!