0

i am programming an app for android.in that I record audios and save them to sdcard.i added name of them to a list. then audios saved to sdcard too. now i want when an audio file that created by my app relate with my app.means when i change thats name in sdcard,change name in list in my app,or when i delete one of them in sdcard ,it be deleted in my list.i dont want save audios info in database or arraylist. i heared about "uri".may be help that?? can help anybody????please help me. what can i do?please... ////////// dont have problem with create file or directory just i want know how any update on sdcard how can update my list or how my app knows its audio files that created by it.

how understands my app that an copied audio file from other place to folder that belongs with my program is not belong it surely...

this idea i was that every time an audio created then listing all audio on my folder on sdcard again. but this some problem,because maybe people chagne or modify(such as copy other audios to my folder or rename that or modify one of audios by cut or merge) now app how understand this event? your help will be appreciate...

4

1 に答える 1

0

アプリによって作成されたオーディオ ファイルがアプリに関連付けられている場合。

まず、アプリによって作成されたオーディオ ファイルを、アプリ用に動的に作成されたフォルダー構造に保存していると仮定します。すべてのオーディオ ファイル用に別のフォルダーを維持してみてください。

次に、 http://developer.android.com/reference/java/io/File.html#listFiles()を使用してファイル リストを簡単に取得できます。

File オブジェクト配列を取得したら、 http://developer.android.com/reference/java/io/File.html#getName()を使用してファイルの名前を取得できます。

それから文字列の配列を作成します。次に、それらをアプリリストに表示します。

これにより、削除や追加について心配する必要がなくなります。

お役に立てれば。

于 2013-10-22T05:18:30.257 に答える