Use Intent.setDataAndType(). Though the formal definition for this intent is that the data is in the stream extra:
http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND <http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND>So if those apps aren't working, they are broken. But if people aren't following the documented protocol then you may need to work around it. :( On Sat, Oct 3, 2009 at 2:03 AM, 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, Lukasz Mosdorf <[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 > > > Lukas Mosdorf > > > > -- > > 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. > > > -- 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 -~----------~----~----~----~------~----~------~--~---

