title: Skipped 48 frames! The application may be doing too much work on its main thread
body: <p>I m retrieving list of song in a ListView but when the app runs on the  emulator, screen is blank. I don't get the list of songs it just shows the following error.</p>
  <blockquote>
  <p>musicmania E/RecyclerView: No adapter attached; skipping layout 01-04
  05:33:07.534 28855-28855/com.example.murarilal.musicmania</p>
  <p>E/RecyclerView: No adapter attached; skipping layout 01-04
  05:33:07.540 28855-28855/com.example.murarilal.musicmania</p>
  <p>I/Choreographer: Skipped 48 frames!  The application may be doing too
  much work on its main thread. 01-04 05:33:07.566
  28855-28874/com.example.murarilal.musicmania D/EGL_emulation:
  eglMakeCurrent: 0x9e2050c0: ver 2 0 (tinfo 0x9e2032d0) 01-04
  05:33:07.903 28855-28862/com.example.murarilal.musicmania W/zygote:</p>
  <p>Suspending all threads took: 17.506ms</p>
  </blockquote>
  <p>SongsTab Activity</p>
  <pre><code>public class SongsTab extends Fragment {
      ArrayList&lt;songInfo&gt; _songs = new ArrayList&lt;songInfo&gt;();
      RecyclerView recyclerView;
      SeekBar seekBar;
      songAdapter songAdapter1;
      MediaPlayer mediaPlayer;
      Handler myHandler = new Handler();
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          View v = inflater.inflate(R.layout.songs, container, false);
          recyclerView = (RecyclerView)v. findViewById(R.id.recyclerView);
          seekBar = (SeekBar) v.findViewById(R.id.seekBar);
          songAdapter1 = new songAdapter(getActivity(),_songs);
          LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
          DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
                  linearLayoutManager.getOrientation());
          recyclerView.setLayoutManager(linearLayoutManager);
          recyclerView.setAdapter(songAdapter1);
          recyclerView.addItemDecoration(dividerItemDecoration);
          return v;
      }
  
  
      public void onViewCreated(View view, Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
          loadSongs();
          // add your code here which executes after the execution of onCreateView() method.
          songAdapter1.setOnItemClickListener(new songAdapter.OnItemClickListener() {
              @Override
              public void onItemClick(RecyclerView.ViewHolder holder, View view, final songInfo obj, int position) {
                  if(mediaPlayer.isPlaying()){
                      mediaPlayer.stop();
                      mediaPlayer.reset();
                      mediaPlayer.release();
                      mediaPlayer = null;
  
                  }else {
  
                      Runnable runnable = new Runnable() {
                          @Override
                          public void run() {
                              try {
                                  mediaPlayer = new MediaPlayer();
                                  mediaPlayer.setDataSource(obj.getSongUrl());
                                  mediaPlayer.prepareAsync();
                                  mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                                      @Override
                                      public void onPrepared(MediaPlayer mp) {
                                          mp.start();
                                          seekBar.setProgress(0);
                                          seekBar.setMax(mediaPlayer.getDuration());
                                          Log.d(&quot;Prog&quot;, &quot;run: &quot; + mediaPlayer.getDuration());
                                      }
                                  });
                                  Log.i(&quot;devesh&quot;,&quot;vikas&quot;);
  
  
  
                              }catch (Exception e){}
                          }
  
                      };
                      myHandler.postDelayed(runnable,100);
  
                  }
              }
          });
          checkUserPermission();
  
          Thread t = new runThread();
          t.start();
  
  
  
      }
      public class runThread extends Thread {
  
          @Override
          public void run() {
  
              while (true) {
  
                  try {
                      Thread.sleep(1000);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
                  Log.d(&quot;Runwa&quot;, &quot;run: &quot; + 1);
                  if (mediaPlayer != null) {
                      seekBar.post(new Runnable() {
                          @Override
                          public void run() {
                              seekBar.setProgress(mediaPlayer.getCurrentPosition());
                          }
                      });
  
                      Log.d(&quot;Runwa&quot;, &quot;run: &quot; + mediaPlayer.getCurrentPosition());
                  }
              }
          }
  
      }
  
      private void checkUserPermission(){
          if(Build.VERSION.SDK_INT&gt;=23){
              if(ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE)
                      != PackageManager.PERMISSION_GRANTED){
                  requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},123);
                  return;
              }
          }
         // loadSongs();
      }
  
      @Override
      public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
          switch (requestCode){
              case 123:
                  if (grantResults[0] == PackageManager.PERMISSION_GRANTED){
                      loadSongs();
                  }else{
                      Toast.makeText(getContext(), &quot;Permission Denied&quot;, Toast.LENGTH_SHORT).show();
                      checkUserPermission();
                  }
                  break;
              default:
                  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  
          }
  
      }
  
      public void loadSongs(){
  
          Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
          String selection = MediaStore.Audio.Media.IS_MUSIC+&quot;!=0&quot;;
          Cursor cursor = getContext().getContentResolver().query(uri,null,selection,null,null);
          if(cursor != null){
              if(cursor.moveToFirst()){
                  do{
                      String name = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
                      String artist = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST));
                      String url = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA));
  
                      songInfo s = new songInfo(name,artist,url);
                      _songs.add(s);
                      songAdapter1.notifyDataSetChanged();
                      recyclerView.setAdapter(songAdapter1);
                  }while (cursor.moveToNext());
              }
  
              cursor.close();
  
          }
  
      }
  }
  
  MainActivity
  
  
  
  public class MainActivity extends AppCompatActivity {
  
      public ViewPagerAdapter pagerAdapter;
      private ViewPager mViewPager;
      private Toolbar toolbar;
      private TabLayout tabLayout;
      public static View rootView;
      public static int tabNo;
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          pagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
          mViewPager = (ViewPager) findViewById(R.id.container);
          tabLayout = (TabLayout) findViewById(R.id.tabs);
          tabLayout.setupWithViewPager(mViewPager);
          mViewPager.setAdapter(pagerAdapter);
          tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
  
  
              @Override
              public void onTabSelected(TabLayout.Tab tab) {
                  tabNo = tab.getPosition();
                  mViewPager.setCurrentItem(tabNo);//setting current selected item over viewpager
  
              }
  
              @Override
              public void onTabUnselected(TabLayout.Tab tab) {
  
              }
  
              @Override
              public void onTabReselected(TabLayout.Tab tab) {
              }
          });
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          int id = item.getItemId();
  
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  
      public static class PlaceholderFragment extends Fragment {
  
          private static final String ARG_SECTION_NUMBER = &quot;section_number&quot;;
  
          public PlaceholderFragment() {
          }
  
          public static PlaceholderFragment newInstance(int sectionNumber) {
              PlaceholderFragment fragment = new PlaceholderFragment();
  
              Bundle args = new Bundle();
              args.putInt(ARG_SECTION_NUMBER, sectionNumber);
              fragment.setArguments(args);
              return fragment;
          }
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
  //              View rootView;
  
              switch (getArguments().getInt(ARG_SECTION_NUMBER))
              {
                  case 1: {
                      rootView = inflater.inflate(R.layout.songs, container, false);
  
                      break;
                  }
                  case 2: {
                      rootView = inflater.inflate(R.layout.album, container, false);
                      break;
                  }
  
                  case 3: {
                      rootView = inflater.inflate(R.layout.genres, container, false);
                      break;
                  }
                  case 4: {
                      rootView = inflater.inflate(R.layout.artist, container, false);
                      break;
                  }
  
              }
              return rootView;
  
  
          }
  
      }
  }
  </code></pre>