jjzjj

MediaStore

全部标签

android - 删除由 MediaStore.Images.Media.insertImage 创建的图像和缩略图

我明白了MediaStore.Images.Media.insertImage(ContentResolvercr,Bitmapsource,Stringtitle,Stringdescription)将创建2个文件(图像和缩略图)如何删除两个已创建的图像? 最佳答案 使用此命令使用您要删除的图像的ID:mediaStoreIds.add(mediaStoreId);context.getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,Bas

android - 获取主存储和二级存储上 DCIM 文件夹的路径

我正在编写一个应用程序,它应该上传存储在内存和SD卡上的DCIM/Camera文件夹中的相机拍摄的照片。这意味着在每次上传之前,必须检查所有可用存储空间是否存在任何图像。我使用Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)访问主存储,它可以是SD卡或内存(取决于设备)。来自文档:Note:don'tbeconfusedbytheword"external"here.Thisdirectorycanbetterbethoughtasmedia/sharedstorage.Itisafile

android - 关于从 Mediastore 获取数据的内部与外部 uri

希望有人能向我澄清这一点......我正在开发一个简单的视频播放器应用程序,可以播放存储在手机上的视频剪辑。我见过的所有示例都使用MediaStore.Video.Media.EXTERNAL_CONTENT_URI内容Uri来获取视频,诸如此类cursor=resolver.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,cols,whereClause,null,sortOrder);但它不会将列表限制为仅存储在SD卡上的文件吗?较新的Android手机具有大量内部存储器-例如,三星GalaxyS通常配备16Gb的内部存储器和2G

android - ThumbnailUtils.createVideoThumbnail 为 mp4 文件返回空位图

当我获取mp4文件的位图时:ThumbnailUtils.createVideoThumbnail(mediaFile.getAbsolutePath(),MediaStore.Video.Thumbnails.MINI_KIND);返回null 最佳答案 试试这个,可能是你的媒体文件路径有误。使用下面的方法你会得到准确的路径。它对我有用Bitmapthumb=ThumbnailUtils.createVideoThumbnail(getPath(outputFileUri),MediaStore.Images.Thumbnails

android - 如何显示歌曲时长

所以我使用Mediastore来获取歌曲持续时间,但我需要将它们转换为秒数我需要将它们格式化为HH:MM:SS(Hours:Minutes:Seconds)我尝试使用TimeUnit但没有用,或者我没有以正确的方式实现它感谢您的帮助抱歉英语不好请帮助。歌曲适配器.java@OverridepublicvoidbindView(Viewview,Contextcontext,Cursorcursor){TextViewtitle1=(TextView)view.findViewById(R.id.titlelist);TextViewartist1=(TextView)view.find

Android 相机 Intent 不应允许将图像保存到图库并将其存储在指定路径中

当我使用这段代码时->IntentcameraIntent=newIntent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,uri);我能够将图像保存到指定路径,但它也保存到图库中。我不想将图像保存到画廊。请在这里帮忙。提前感谢您抽出宝贵时间。 最佳答案 试试这个privatevoidcaptureCameraImage(){IntentchooserIntent=newIntent(M

android - MediaStore.Images.Media.insertImage - java.io.FileNotFoundException - Android

Note:similarquestionisaskedoverbelowSOlinks,butnoneoftheproposedsolutionworkedforme,hencestartingthisthread.MediaStore.Images.Media.insertImageisreturningnullwhentryingtosavetheimageWhyImages.Media.insertImagereturnnull问题陈述:我正在从url下载图像,然后尝试共享它。为此,我需要Uri,这是我通过将图像保存在MediaStore.Images.Media中获得的。代码:

Android Camera Intent 创建两个文件

我正在制作一个拍摄照片然后显示其缩略图的程序。使用模拟器时一切顺利,丢弃按钮会删除照片。但在真实设备上,相机Intent将图像保存在imageUri变量中,第二个图像的命名就像我刚刚打开相机并自己拍了一张照片一样。privatestaticfinalintCAMERA_PIC_REQUEST=1337;/**Calledwhentheactivityisfirstcreated.*/@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView

android - 如何让我的铃声在 Android 中播放?

我正在制作音板应用程序,并尝试根据单击的菜单项将声音作为铃声或通知播放。铃声当前在铃声菜单中显示为默认铃声,但在来电时不会播放。我做错了什么?下面列出了我的代码。publicbooleansaveas(intressound,Stringfile,Stringtypesound){byte[]buffer=null;InputStreamfIn=getBaseContext().getResources().openRawResource(ressound);intsize=0;try{size=fIn.available();buffer=newbyte[size];fIn.read

android - MediaStore.Playlists.Members.moveItem 的替代品

我一直在使用以下代码从我的Android应用程序的播放列表中删除一个项目:privatevoidremoveFromPlaylist(longplaylistId,intloc){ContentResolverresolver=getApplicationContext().getContentResolver();Uriuri=MediaStore.Audio.Playlists.Members.getContentUri("external",playlistId);resolver.delete(uri,MediaStore.Audio.Playlists.Members.PLA