It always return null on 4.3, and works perfectly on all other versions. On Aug 2, 2013 10:13 PM, "Nobu Games" <[email protected]> wrote:
> I just had a quick peek at the API level 14 source code and it looks like > there are two possible reasons for that problem: > > 1. The actual ContentProvider the ContentResolver connected to returns > null on insert (for whatever reason, that is a mystery) > 2. A RemoteException was thrown during the insert operation. The exception > is caught by the ContentResolver and it returns just null instead. The > reason for that is (according to the source code comment) that the process > / app is about to die anyway. > > Other ContentResolver methods behave exactly the same. Also the query > methods. It can - without a warning - just return null, even though it > works in your tests a million times. > > You therefore need to check the result for null and come up with a > strategy for coping with that problem, like scheduling a re-query or > checking if your activity is about to be finished. > > On Friday, August 2, 2013 12:29:31 PM UTC-5, eli wrote: >> >> This code works on all Android versions except on 4.3: >> >> ContentValues content = new ContentValues(4); >> content.put(Video.**VideoColumns.TITLE, "vid.mp4"); >> content.put(Video.**VideoColumns.DATE_ADDED, >> System.currentTimeMillis() / 1000); >> content.put(Video.Media.MIME_**TYPE, "video/mp4"); >> content.put(MediaStore.Video.**Media.DATA, >> "/sdcard/vid.mp4"); >> ContentResolver resolver = getContentResolver(); >> * Uri uri = resolver.insert(MediaStore. >> Video.Media.EXTERNAL_CONTENT_URI,* >> * content);* >> >> On 4.3 *uri *is null. >> Can someone help? >> >> Thanks, >> Eli >> > -- > -- > 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 a topic in the > Google Groups "Android Developers" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/android-developers/I-nzRB0w6DM/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

