如何独特的是Android中MediaStore _ID列? [英] How unique is _ID column in Android MediaStore?

查看:144
本文介绍了如何独特的是Android中MediaStore _ID列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了具有节能播放列表(的音乐集)到磁盘的能力,一个Android音乐播放器应用程序。不过,我有一些问题,我用Google搜索,但没有什么能满足我。

I'm developing an Android music player app that has a capability of saving playlists (collection of musics) to disk. However I got some questions, I have googled it but nothing can satisfy me.

大多数教程/指导我发现总是用_ID(它有整数/ long类型,据我可以告诉)来区分彼此之间的音乐文件。如何独特的是什么呢?

Most of the tutorials/guide I found always use _ID (it has integer/long datatype as far as I can tell) to distinguish music files among each others. How unique is it?

这是我的意思是可以这样描述的独特性:

The uniquenesses that I mean can be described like this:


  1. 我发现_ID好像顺序编号。如果我添加/删除音乐,会发生什么,将另外的音乐'的ID得到改变?

  2. 它是安全的我的播放列表数据存储为音乐ID的列表?将播放列表使用任一用户的更改将音乐文件在磁盘上保留?

感谢。

推荐答案

_ids是唯一的。就像数据库ID通常是自动递增。所以,如果是增加了一个项目,它将使用previous添加ID + 1。所以,如果你删除一个项目,在数据库中的其他ID都没有变(所以会有差距=>无后顾之忧)

_IDs are unique. Just like databases the ID is usually autoincremented. So if a item is added it will use the previous added ID + 1. So if you delete an item, the other IDs in the database are not changed (so there will be gaps => no worries)

因此​​,对于第2个问题,它是安全的。

So for question 2, it's safe.

这篇关于如何独特的是Android中MediaStore _ID列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆