-8

How to make a share button in my image application so that when we press share button it share the current image to different option like whats app,facebook etc.Plz Answer That

1 Answers1

2

See the tutorial in the Android docs on Adding an Easy Share Action. It tells you exactly what you are asking.

That tutorial uses a ShareActionProvider, which is only since API 14. To support earlier versions of Android, take a look at the accepted answer in this thread. This third-party tutorial also provides lots of good info.

Community
  • 1
  • 1
Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
  • `ShareActionProvider` is also supported via the AppCompat backport and the ActionBarSherlock backport of the action bar. – CommonsWare Nov 11 '13 at 18:19
  • @CommonsWare - Good to know. I guess it kind of makes the other resources obsolete. – Ted Hopp Nov 11 '13 at 18:20
  • Well, the OP may not be using an action bar and wants a more traditional button, in which case `startActivity()` is the right answer. – CommonsWare Nov 11 '13 at 18:22