English 中文(简体)
如何前往Join MediaStore.Audio.Media
原标题:how to Join MediaStore.Audio.Media

Hi im using merge cursor to show the data result in my list view, i added an indexer and all its working fine but i noticed the a-z its ok show me the External Data, after that again a-z but now internal data, so my index "works" but not as i wish, i know mergecursor cant be sorted so im wondering can i do a rawquery? to join MediaStore.Audio.Media.INTERNAL_CONTENT_URI and MediaStore.Audio.Media.EXTERNAL_CONTENT_UR ?? and how? i want to join and then sort by Song ASC. or MediaStore.Audio.Media.DEFAULT_SORT_ORDER or how i can convert an array list or other collection to cursor?

现行法典:

private Cursor getInternalAudioCursor(String selection,
    String[] selectionArgs) {
return this.getContentResolver().query(
        MediaStore.Audio.Media.INTERNAL_CONTENT_URI,
        INTERNAL_COLUMNS,
        selection,
        selectionArgs,
        MediaStore.Audio.Media.DEFAULT_SORT_ORDER);

iii

private Cursor getExternalAudioCursor(String selection,
    String[] selectionArgs) {
return this.getContentResolver().query(
        MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
        EXTERNAL_COLUMNS,
        selection,
        selectionArgs,
        MediaStore.Audio.Media.DEFAULT_SORT_ORDER);

iii

Cursor c = new MergeCursor(new Cursor[] {
        getExternalAudioCursor(selection, argsArray),
        getInternalAudioCursor(selection, argsArray)iii);
startManagingCursor(c);
问题回答

页: 1 ......

  • MediaStore (actually MediaProvider) is a ContentProvider, not an SQLiteDatabase (it is under that abstraction layer though) - it does not provide those SQLite operations intentionally since you could have other things backing a ContentProvider than an SQLite database.
  • internal and external are separate database files & accessed separately. You can t build queries that refer to another file (unless you attach them which you can t since you don t have access to that low level)

您可建立一个rel=“nofollow”>MatrixCursor,其中你将这两种来源的索引数据按顺序排列。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签