If available, you should prefer the share action provider shown in the second example. It was added in Android 4.0 (API 14) as part of the Action Bar, and it's been backported to Android 2.1 (API 7) as part of the support library.
This method is quicker and easier for users. The share button can remain on the screen at all times, and the most recently used providers automatically gets top priority (a dedicated button and/or top billing in the dropdown list). Notice how quick and easy it is to share with Gmail (one press) in the second example compared with the first (long press to open the dialog, then scroll to find Gmail in a potentially long list of other apps, then press again to select Gmail).
Generally, you would only consider a popup application chooser dialog in these cases:
- Your application needs to be compatible with versions of Android before API 7.
- Your application runs full screen and has no Action Bar.
- There are different types or meanings for sharing on the same screen (e.g., entire directory vs. single file) and you can't use a Contextual Action Bar.