ok, I am able to send the image through the gmail with the following
code:

Intent intent = new Intent(Intent.ACTION_SEND, null);
intent.putExtra(Intent.EXTRA_STREAM,Uri.parse
(Environment.getExternalStorageDirectory()+"/Ania.jpg"));
intent.setType("image/jpeg");
startActivity(Intent.createChooser(intent,"Share a picture or sth"));

But it doesnt work with picasa application and for example twitdroid.
Pictures shared from gallery works that way. What am i doing wrong?

On 3 Paź, 11:03, Lukasz Mosdorf <[email protected]> wrote:
> ok, but, if I use intent.setType("image/*") it clears any data that
> was previously set by setData(Uri). Sow how do I specify MIME type?
>
> On 3 Paź, 02:13, Dianne Hackborn <[email protected]> wrote:
>
> > You need to specify a MIME type, since your data isn't in a content provider
> > that the system can ask for its type.
>
> > On Fri, Oct 2, 2009 at 4:06 PM, 
> > LukaszMosdorf<[email protected]>wrote:
>
> > > Hi
>
> > > I'm trying to make a 'share' option in menu, just like in the gallery
> > > application.
> > > I am using the following code:
>
> > >  MenuItem item2 = menu.add(0,0,0, "Share");
> > >        item2.setOnMenuItemClickListener(new
> > > MenuItem.OnMenuItemClickListener() {
> > >            public boolean onMenuItemClick(MenuItem item) {
> > >                Intent intent = new Intent(Intent.ACTION_SEND, null);
> > >                File f = new File
> > > (Environment.getExternalStorageDirectory()+"/Ania.jpg");
> > >                intent.setData(Uri.fromFile(f));
>
> > >                startActivity(Intent.createChooser(intent,"Share a
> > > picture or sth"));
> > >                return true;
> > >            }
> > >        });
>
> > > When i press the Share button in the menu i get "No applications can
> > > perform this action".
> > > What am I doing  wrong? (im working on a real device not the
> > > emulator).
>
> > > regards
> > > LukasMosdorf
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to