title: Blank screen on Activity start even with correct onCreate() and setContentView()
body: <p>I am getting a blank screen whenever I try to launch <strong>PlayListActivity.java</strong> from <strong>Bacon1.java</strong> on clicking a button which is <strong><em>button4</em></strong> or <strong><em>button_audio</em></strong> . I think there is nothing wrong  with onCreate() and setContentView(). But I cant't understand still why I am getting a blank screen every time that activity launches.How to resolve this ?</p>
  
  <p>This is the launcher Activity : <strong>Bacon1.java</strong>  </p>
  
  <pre><code>package com.example.dell_1.myapp3;
  
  import android.Manifest;
  import android.content.Intent;
  import android.content.pm.PackageManager;
  import android.net.Uri;
  import android.os.Bundle;
  import android.app.Activity;
  import android.os.Environment;
  import android.support.design.widget.Snackbar;
  import android.support.v4.app.ActivityCompat;
  import android.support.v4.content.ContextCompat;
  import android.view.View;
  import android.widget.Toast;
  import java.io.File;
  
  
  public class Bacon1 extends Activity {
  
      private static int RESULT_LOAD_IMAGE = 1;
      private static int MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_bacon1);
      }
  
  
  
                      public void onClick3(View v) {
                          buttonClicked(v);
  
                          Intent o = new Intent(this,PlayListActivity.class);
                          startActivity(o);
      }
  
  
      private void buttonClicked(View view) {
  
          if (ContextCompat.checkSelfPermission(this,
                  Manifest.permission.READ_EXTERNAL_STORAGE)
                  != PackageManager.PERMISSION_GRANTED) {
  
              Snackbar.make(view, "Permission not Granted, Requesting permission.", Snackbar.LENGTH_LONG).show();
              if (ActivityCompat.shouldShowRequestPermissionRationale(this,
                      Manifest.permission.READ_EXTERNAL_STORAGE)) {
  
                  Snackbar.make(view, "We need permission to internal storage for displaying songs", Snackbar.LENGTH_LONG).show();
  
              } else {
  
                  Snackbar.make(view, "Allow myapp3 to access this device's internal storage", Snackbar.LENGTH_LONG).show();
  
                  ActivityCompat.requestPermissions(this,
                          new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
                          MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
  
                  // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
                  // app-defined int constant. The callback method gets the
                  // result of the request.
              }
          }
      }
  
  
      public void onClick2(View view) {
  
          Intent i = new Intent(
                  Intent.ACTION_PICK,
                  android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
  
          startActivityForResult(i, RESULT_LOAD_IMAGE);
      }
  
  
      public void onClick4(View view) {
  
          Intent viewIntent1 = new Intent(Intent.ACTION_VIEW);
          File file = Environment.getExternalStorageDirectory();
          viewIntent1.setDataAndType(Uri.fromFile(file), "video/*");
          startActivity(Intent.createChooser(viewIntent1, null));
      }
  
      public void onClick5(View view) {
  
          Intent viewIntent1 = new Intent(Intent.ACTION_VIEW);
          File file = Environment.getExternalStorageDirectory();
          viewIntent1.setDataAndType(Uri.fromFile(file), "zip/*");
          startActivity(Intent.createChooser(viewIntent1, null));
      }
  
      public void onClick6(View view) {
  
          Intent viewIntent1 = new Intent(Intent.ACTION_VIEW);
          File file = Environment.getExternalStorageDirectory();
          viewIntent1.setDataAndType(Uri.fromFile(file), "text/*");
          startActivity(Intent.createChooser(viewIntent1, null));
      }
  
      public void onClick7(View view) {
  
          Intent viewIntent1 = new Intent(Intent.ACTION_VIEW);
          File file = Environment.getExternalStorageDirectory();
          viewIntent1.setDataAndType(Uri.fromFile(file), "application/*");
          startActivity(Intent.createChooser(viewIntent1, null));
      }
  
  
      @Override
      public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
          switch (requestCode) {
              case 1: {
                  // If request is cancelled, the result arrays are empty.
                  if (grantResults.length &gt; 0
                          &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                      Toast.makeText(Bacon1.this, "WRITE_CONTACTS granted", Toast.LENGTH_SHORT)
                              .show();
  
                  } else {
  
                      Toast.makeText(Bacon1.this, "WRITE_CONTACTS Denied", Toast.LENGTH_SHORT)
                              .show();
  
                  }
                  return;
              }
  
              // other 'case' lines to check for other
              // permissions this app might request
          }
      }
  
      }
  </code></pre>
  
  <p>This is the corresponding xml : <strong>activity_bacon1.xml</strong> </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.example.dell_1.myapp3.Bacon1"&gt;
  
      &lt;ImageView
          android:id="@+id/imgView"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="1"&gt;
      &lt;/ImageView&gt;
  
  
      &lt;Button
          android:id="@+id/button3"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_alignParentTop="true"
          android:layout_marginLeft="134dp"
          android:layout_marginStart="134dp"
          android:layout_marginTop="63dp"
          android:onClick="onClick2"
          android:text="@string/button_images" /&gt;
  
      &lt;Button
          android:id="@+id/button4"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignLeft="@+id/button3"
          android:layout_alignStart="@+id/button3"
          android:layout_below="@+id/button3"
          android:layout_marginTop="22dp"
          android:onClick="onClick3"
          android:text="@string/button_audio" /&gt;
  
      &lt;Button
          android:id="@+id/button5"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignLeft="@+id/button4"
          android:layout_alignStart="@+id/button4"
          android:layout_below="@+id/button4"
          android:layout_marginTop="20dp"
          android:onClick="onClick4"
          android:text="@string/button_videos" /&gt;
  
      &lt;Button
          android:id="@+id/button6"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignLeft="@+id/button5"
          android:layout_alignStart="@+id/button5"
          android:layout_below="@+id/button5"
          android:layout_marginTop="16dp"
          android:onClick="onClick5"
          android:text="@string/button_zip" /&gt;
  
      &lt;Button
          android:id="@+id/button7"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignLeft="@+id/button6"
          android:layout_alignStart="@+id/button6"
          android:layout_below="@+id/button6"
          android:layout_marginTop="19dp"
          android:onClick="onClick7"
          android:text="@string/button_apps" /&gt;
  
      &lt;Button
          android:id="@+id/button8"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="26dp"
          android:text="@string/button_documents"
          android:layout_below="@+id/button7"
          android:layout_alignLeft="@+id/button7"
          android:onClick="onClick6"
          android:layout_alignStart="@+id/button7" /&gt;
  
      &lt;TextView
          android:id="@+id/textView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="25dp"
          android:text="@string/text_internal"
          android:textAppearance="@android:style/TextAppearance.Large"
          android:layout_alignParentTop="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginLeft="99dp"
          android:layout_marginStart="99dp" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is the launched Activity : <strong>PlayListActivity.java</strong>   </p>
  
  <pre><code>package com.example.dell_1.myapp3;
  
  
  import android.app.ListActivity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ListAdapter;
  import android.widget.ListView;
  import android.widget.SimpleAdapter;
  import java.util.ArrayList;
  import java.util.HashMap;
  
  public class PlayListActivity extends ListActivity {
      // Songs list
      public ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_play_list);
  
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsListData = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  
          SongsManager plm = new SongsManager();
          // get all songs from sdcard
          this.songsList = plm.getPlayList();
  
          // looping through playlist
          for (int i = 0; i &lt; songsList.size(); i++) {
              // creating new HashMap
              HashMap&lt;String, String&gt; song = songsList.get(i);
  
              // adding HashList to ArrayList
              songsListData.add(song);
          }
  
          // Adding menuItems to ListView
          ListAdapter adapter = new SimpleAdapter(this, songsListData,
                  R.layout.playlist_item, new String[]{"songTitle"}, new int[]{
                  R.id.songTitle});
  
          setListAdapter(adapter);
  
          // selecting single ListView item
          ListView lv = getListView();
          // listening to single listitem click
          lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                      int position, long id) {
                  // getting listitem index
                  int songIndex = position;
  
                  // Starting new intent
                  Intent in = new Intent(getApplicationContext(),
                          AndroidBuildingMusicPlayerActivity.class);
                  // Sending songIndex to PlayerActivity
                  in.putExtra("songIndex", songIndex);
                  setResult(100, in);
                  // Closing PlayListView
                  finish();
              }
          });
      }
  
  
  }
  </code></pre>
  
  <p>This is the corresponding xml file :   <strong>activity_play_list</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"&gt;
  
      &lt;ListView
          android:id="@android:id/list"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:divider="#242424"
          android:dividerHeight="1dp"
          android:listSelector="@drawable/list_selector" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>