How can I take: "Create a wav file and stock this into a data storage with Content Providers"
I try to use the same thing like the following exemple: http://developer.android.com/intl/fr/guide/topics/providers/content-providers.html with a Bitmap: import android.provider.MediaStore.Images.Media; import android.content.ContentValues; import java.io.OutputStream; // Save the name and description of an image in a ContentValues map. ContentValues values = new ContentValues(3); values.put(Media.DISPLAY_NAME, "road_trip_1"); values.put(Media.DESCRIPTION, "Day 1, trip to Los Angeles"); values.put(Media.MIME_TYPE, "image/jpeg"); // Add a new record without the bitmap, but with the values just set. // insert() returns the URI of the new record. Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values); // Now get a handle to the file for that record, and save the data into it. // Here, sourceBitmap is a Bitmap object representing the file to save to the database. try { OutputStream outStream = getContentResolver().openOutputStream (uri); sourceBitmap.compress(Bitmap.CompressFormat.JPEG, 50, outStream); outStream.close(); } catch (Exception e) { Log.e(TAG, "exception while writing image", e); So I think is too similar but I'm really lose !! Firstly I don't find how to create my File with my byte[]. I try to make that: byte[] decoded = Base64.decode( tabMsg[0].getMsgBase64() ); ContentValues values = new ContentValues(); values.put(Media.DISPLAY_NAME, "Voicemail1"); values.put(Media.MIME_TYPE, "Audio/wav"); Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values); File m_wav = new File(uri.getEncodedPath(), "voicemail1.wav"); try { OutputStream outStream = getContentResolver().openOutputStream (uri); outStream.write(decoded); outStream.close(); } catch (Exception e) { Log.e(TAG, "Exception while writing audio", e); } Could you light me, please ?? What are you thinking about my little code and how can I continuous ??? It's very hard to use the better arguments or parametres with: values.put(...) and with : getContentResolver().insert(..) Maybe I have to create my own Content Providers but I think is too compicated ! Dany --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---