Hi Fina, I think below code will work: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, ...);
Then you can handle the bitmap in onActivityResult(). The code you mentioned is from android built-in Camera application. There you can see how camera app give result to you. From that you can get how to handle the result. On Tue, Apr 26, 2011 at 3:51 PM, Fina Perez <[email protected]> wrote: > Hi Liang! > thanks a lot for your answer. > > I was trying the first option but I'm having problems to tell the > camera that I want a bitmap. I tryed to use the method > "Inteng.#setType(String)" but I got an exception And I don't know > where the code you wrote comes from, I mean Is that the way to ask for > a bitmap object as result? I thought it was more "intuitive" hehehe > > On Apr 22, 11:56 am, Liang Wang <[email protected]> wrote: > > 1. You can let camera return bitmap data, then you handle the data by > > yourself. There is no file saved this way. > > > > 2. If you let camera save the image to file in a specified > directory(through > > provider), making a empty file named .nomedia in that directory can > prevent > > mediascanner from scanning it. This way this image will not appear in > > gallery. > > > > See the code below in Camera: > > if (mSaveUri != null) { > > OutputStream outputStream = null; > > try { > > outputStream = > > mContentResolver.openOutputStream(mSaveUri); > > outputStream.write(data); > > outputStream.close(); > > > > setResult(RESULT_OK); > > finish(); > > } catch (IOException ex) { > > // ignore exception > > } finally { > > Util.closeSilently(outputStream); > > } > > } else { > > Bitmap bitmap = createCaptureBitmap(data); > > setResult(RESULT_OK, > > new Intent("inline-data").putExtra("data", > bitmap)); > > finish(); > > } > > > > On Fri, Apr 22, 2011 at 4:51 PM, Fina Perez <[email protected]> > wrote: > > > Hi! > > > > > I answer myself: > > > > > maybe is not the best solution but after deleting the file, this is > > > what I do: > > > > > sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, > > > Uri.parse("file://" + Environment.getExternalStorageDirectory()))); > > > > > we need to add this to the manifest: > > > <intent-filter> > > > <action android:name="android.intent.action.MEDIA_MOUNTED" /> > > > <data android:scheme="file" /> > > > </intent-filter> > > > > > (I found the solution here: > > > > >http://stackoverflow.com/questions/4430888/android-file-delete-leaves. > .. > > > ) > > > > > On Apr 21, 11:32 am, Fina Perez <[email protected]> wrote: > > > > Hi all! > > > > > > I'm using the built-in camera in my app to take a picture and to > save > > > > it in a database. So, from my activity, I launch the camera, take a > > > > picture and go back to the activity (thanks to "onActivityResult" > > > > method). Here, I store the picture in the database and I delete it > > > > from the phone. Seems to be working properly: the picture is being > > > > deleted from the sdcard but if you go to the gallery app that comes > > > > with the device, the picture is being displayed but as a "wrong > file", > > > > so you can see that there is/was a picture there but you can't open > it > > > > or even see the preview. But I can delete it from the gallery app > > > > manually (selecting them and then deleting). How can i do this > > > > programatically? > > > > > > Thanks a lot! I really need help with this > > > > > -- > > > 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 > > -- > 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 > -- 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

