No Adapter Attach,skipping Layout
I am getting an error saying no adapter attach skipping layout.and the list doesn't appear in when emulator runs.please help.I cant see anything in list.screen appears blank.other
Solution 1:
Because Your _songs ArrayList
is Empty
.
Solution 2:
Try this
privatevoidloadSongs(){
Uriuri= MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
Stringselection= MediaStore.Audio.Media.IS_MUSIC+"!=0";
cursor =getActivity().getContentResolver().query(uri,null,selection,null,null);
if(cursor != null){
if(cursor.moveToFirst()){
do{
Stringname= cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE));
Stringartist= cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST));
intsongPath= cursor.getColumnIndex(MediaStore.Audio.Media.DATA);
songInfos=newsongInfo(name,artist,songPath);
_songs.add(s);
songAdapter1 = newsongAdapter(_songs,getActivity());
recyclerView.setAdapter(songAdapter1);
}while (cursor.moveToNext());
}
cursor.close();
}
}
Post a Comment for "No Adapter Attach,skipping Layout"