1. Android Central Question's Avatar
    in my music player i want to get songs from album,but it gives me error in the logs.please explain me this error why this occurs.i saw all the previous question on stackoverflow about this problem but couldnt understand,please help.

    public void getAlbumsLists() {
    final Uri uri = MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI;
    _id = MediaStore.Audio.Albums._ID;
    final String album_name = MediaStore.Audio.Albums.ALBUM;
    final String artist = MediaStore.Audio.Albums.ARTIST;
    tracks = android.provider.MediaStore.Audio.Albums.NUMBER_OF_SONGS;
    final String data=MediaStore.Audio.Media.DATA;
    final String id1=MediaStore.Audio.Media._ID;
    final String tit=MediaStore.Audio.Media.TITLE;
    final String nam=MediaStore.Audio.Media.DISPLAY_NAME;
    final String typ=MediaStore.Audio.Media.MIME_TYPE;
    final String[] columns = {_id, album_name, artist, tracks,data,id1,tit,nam,typ};

    cursor = getContext().getContentResolver().query(uri, columns,null, null, null);
    if (cursor != null && cursor.moveToFirst()&&cursor.getCount()>0)
    do {
    int x=cursor.getColumnCount();
    System.out.println(x);
    String id = (cursor.getString(cursor.getColumnIndex(_id)));
    String name = cursor.getString(cursor.getColumnIndex(album_name));
    String artist2 = cursor.getString(cursor.getColumnIndex(artist));
    String nr = cursor.getString(cursor.getColumnIndex(tracks));
    String data1=cursor.getString(cursor.getColumnIndexOrThrow(data));
    String id2=cursor.getString(cursor.getColumnIndex(id1));
    String title=cursor.getString(cursor.getColumnIndex(tit));
    String name1=cursor.getString(cursor.getColumnIndex(nam));
    String type=cursor.getString(cursor.getColumnIndex(typ));
    albumInfo s = new albumInfo(id, name, artist2, nr,data,id2,title,name1,type);
    albumList.add(s);
    } while (cursor.moveToNext());

    if (cursor != null) {
    cursor.close();
    }
    recyclerView1.setAdapter(albumAdapter);
    }

    this is logcat

    android.database.sqlite.SQLiteException: no such column: data (code 1): , while compiling: SELECT _id, album, artist, numsongs, duration, _id, title, _display_name, mime_type FROM album_info at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:179) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135) at android.content.ContentProviderProxy.query(ContentProviderNative.java:418) at android.content.ContentResolver.query(ContentResolver.java:754) at android.content.ContentResolver.query(ContentResolver.java:704) at android.content.ContentResolver.query(ContentResolver.java:662) at layout.BlankFragment.getAlbumsLists(BlankFragment.java:154) at layout.BlankFragment.onCreateView(BlankFragment.java:138)
    02-04-2018 12:09 AM

Similar Threads

  1. How do i get my screen color back to normal
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 02-04-2018, 04:51 AM
  2. How can I get my Mac to recognize my Revvl Plus?
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 02-04-2018, 04:42 AM
  3. My files become corrupted after downloading?
    By Jomsss in forum Legacy Android & Other OS's
    Replies: 1
    Last Post: 02-04-2018, 02:57 AM
  4. Replies: 1
    Last Post: 02-04-2018, 02:55 AM
  5. When will get Cortana?
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 02-03-2018, 10:56 PM
LINK TO POST COPIED TO CLIPBOARD