hum, that doesnt work... When I am using the following code: Intent intent = new Intent(Intent.ACTION_SEND, null); intent.putExtra(Intent.EXTRA_STREAM,Uri.parse (Environment.getExternalStorageDirectory()+"/Ania.jpg")); intent.setDataAndType(Uri.parse(Environment.getExternalStorageDirectory ()+"/Ania.jpg"), "image/jpeg"); startActivity(Intent.createChooser(intent,"Share a picture or sth")); AppSettings.NOTIFY_SAVE_OPENED = false;
the only app that doesnt crash is gmail. Unfortunatelly it doesnt send attachment, only the text part of the e-mail, even though the attachement is listed before sending. I guess there has to be solution for this, becouse gallery application works well with gmail, picasa and twitdroid. I was trying to pass a direct bitmap data to the EXTRA_STREAM: Intent intent = new Intent(Intent.ACTION_SEND, null); Bitmap bm = mDraw.getSnapshot(); //method returning a bitmap int value[] = new int[bm.getHeight() * bm.getWidth()]; mDraw.getSnapshot().getPixels(value, 0, bm.getWidth(), 0, 0, bm.getWidth(), bm.getHeight()); intent.putExtra(Intent.EXTRA_STREAM,value); intent.setType("image/jpeg"); startActivity(Intent.createChooser(intent,"Share a picture or sth")); but that still doesnt work :( Anyone can help? regards Lukasz Mosdorf On Oct 4, 2:21 am, Dianne Hackborn <hack...@android.com> wrote: > 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#AC... > > <http://developer.android.com/reference/android/content/Intent.html#AC...>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 > <lukasz.mosd...@gmail.com>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 <hack...@android.com> 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 <lukasz.mosd...@gmail.com > > >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 > > > hack...@android.com > > > > 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 > hack...@android.com > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---