title: Android getting Black Screen when Switching from SplashActivity to AnotherActivity
body: <p>I'm facing a problem when moving from <code>SplashScreen</code> activity to <code>AnotherActivity</code>. The Problem is that I'm getting a <code>BlackScreen</code> after <code>SplashScreen</code> disappears and before <code>MainActivity</code> screen loads.</p>
  
  <p>Does anyone have any suggestions?</p>
  
  <p>Here my code:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Splash  extends Activity{
  
      public List&lt;SaxMessage&gt; torimsg = new ArrayList&lt;SaxMessage&gt;();
      static final int DIALOG_ERROR_CONNECTION = 1;
      static final int DIALOG_ERROR_CONNECTION2 = 2;
      static final int DIALOG_ERROR_CONNECTION3 = 3;
      Boolean connected;
      String dialogMessage;
      Context context;
       @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          SplashHandler mHandler = new SplashHandler();
          setContentView(R.layout.splash);
          context=getApplicationContext();
           connected=isOnline(getApplicationContext());
              Log.d("connection","connection:"+connected);
              // Create a Message object
              Message msg = new Message();
              //Assign a unique code to the message.
              //Later, this code will be used to identify the message in Handler class.
              msg.what = 0;
              // Send the message with a delay of 3 seconds(3000 = 3 sec).
              mHandler.sendMessageDelayed(msg, 1000);
          } //onCreate
  
        private Boolean isOnline(Context conn) {
              ConnectivityManager cm = (ConnectivityManager)conn. getSystemService(Context.CONNECTIVITY_SERVICE);
              NetworkInfo networkinfo = cm.getActiveNetworkInfo();
              if (networkinfo != null &amp;&amp; networkinfo.isAvailable()
                      &amp;&amp; networkinfo.isConnected()) {     
                  return true;
              }
              return false;
          }
          @Override
          protected Dialog onCreateDialog(int id) {
            Dialog dialog = null;
  
            switch (id) {
            case DIALOG_ERROR_CONNECTION:
              AlertDialog.Builder errorDialog = new AlertDialog.Builder(this);
              errorDialog.setTitle("Error");
              errorDialog.setMessage(dialogMessage);
              errorDialog.setNeutralButton("Retry",
              new DialogInterface.OnClickListener() {
  
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                    torimsg.clear();
                    new DownloadLocalXmlTask().execute();  
                }
              });
  
             AlertDialog errorAlert = errorDialog.create();
             return errorAlert;
           case DIALOG_ERROR_CONNECTION2:
                  AlertDialog.Builder errorDialog1 = new AlertDialog.Builder(this);
                  errorDialog1.setTitle("Error");
                  errorDialog1.setMessage("No internet connection.");
                  errorDialog1.setNeutralButton("OK",
                  new DialogInterface.OnClickListener() {
  
                    public void onClick(DialogInterface dialog, int id) {
                      dialog.dismiss();
                     Splash.this.finish();
                    }
                  });
  
                 AlertDialog errorAlert1 = errorDialog1.create();
                 return errorAlert1;
  
          case DIALOG_ERROR_CONNECTION3:
               AlertDialog.Builder errorDialog2 = new AlertDialog.Builder(this);
              errorDialog2.setTitle("Error");
              errorDialog2.setMessage(dialogMessage);
              errorDialog2.setNeutralButton("Ok",
              new DialogInterface.OnClickListener() {
  
                public void onClick(DialogInterface dialog, int id) {
                  dialog.dismiss();         
                 Splash.this.finish();
                }
              });
  
             AlertDialog errorAlert2 = errorDialog2.create();
             return errorAlert2;
  
            default:
              break;
            }
          return dialog;
          }
  
  
          private class DownloadXmlTask extends AsyncTask&lt;String, Void, List&lt;SaxMessage&gt;&gt;{
              @Override
              protected List&lt;SaxMessage&gt; doInBackground(String... urls) {
  
                  try{
                          SAXParserFactory saxParserFactory= SAXParserFactory.newInstance();
                          SAXParser saxParser = saxParserFactory.newSAXParser();
  
                          XMLReader xr = saxParser.getXMLReader();
                          URL sourceUrl = new URL ("http://toucheradio.com/toneradio/android/toriLite/toriplaylist.xml");
                          RssHandler handler = new RssHandler();
                          xr.setContentHandler(handler);                  
                          xr.parse(new InputSource(sourceUrl.openStream()));          
                          torimsg= handler.getMessages();
                          torimsg.remove(0);
                          return torimsg;
                      } 
                      catch(UnknownHostException e)
                      {
                          showMyDialog(e.getMessage());
                          return null;
                      }
                      catch(SAXParseException se)
                      {
                          showMyDialog(se.getMessage());
                          return null;
                      }
                      catch (Exception e) {
                          showMyDialog(e.getMessage());
                          return null;
                      }   
              }
  
              @Override
              protected void onPostExecute(List&lt;SaxMessage&gt; result) {  
                  if(result==null)
                  {               
                      showDialog(DIALOG_ERROR_CONNECTION);
                  }
                  else
                  {
                      Intent intent= new Intent(Splash.this,TORiLTActivity.class);
                      Bundle b=new Bundle();
                      b.putParcelableArrayList("torimsg", (ArrayList&lt;? extends Parcelable&gt;) torimsg); 
                      intent.putExtras(b);             
                      startActivity(intent); 
                      // finish the current activity
                      Splash.this.finish();
                  }
              }
          }
  
          private void showMyDialog(String b) {
              Splash.this.dialogMessage=b;
          }
       private class SplashHandler extends Handler {
  
              //This method is used to handle received messages
              public void handleMessage(Message msg)
                {
                  // switch to identify the message by its code
                  switch (msg.what)
                  {
                  default:
                  case 0:
                    super.handleMessage(msg);
                    if(connected==false)
                      {                   
                          showDialog(DIALOG_ERROR_CONNECTION2);   
                      }
                      else
                      {
                          new DownloadXmlTask().execute();
                      }
                  }
                } 
      }
  }
  </code></pre>
  
  <p>Update:</p>
  
  <pre class="lang-java prettyprint-override"><code>public void onCreate(Bundle savedInstanceState) {
          Log.i("HS1", "onCreate");
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          Bundle recdData = getIntent().getExtras();
  
          messages = recdData.getParcelableArrayList("torimsg");
          //new getHtmlDataAync().execute();
          albumAdapter=new LazyAdapter(TORiLTActivity.this, messages);  
          this.setListAdapter(albumAdapter);
          bindToService();
          //contentList.setFastScrollEnabled(true);
  
          buttonMethode();
          AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 1);
  
             AdWhirlTargeting.setAge(23);
  
             AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
  
             AdWhirlTargeting.setKeywords("online games gaming");
  
             AdWhirlTargeting.setPostalCode("94123");
  
             AdWhirlTargeting.setTestMode(false);
  
             AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this,"ce9849662b9844468e942e4e3de6e2c8");
  
             RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  
  
             layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
  
             layout = (LinearLayout)findViewById(R.id.linearlayout01);
  
             layout.setGravity(Gravity.CENTER_HORIZONTAL);
  
             layout.addView(adWhirlLayout, layoutParams);
  
             layout.invalidate();    
  
          this.facebookConnector = new FacebookConnector(FACEBOOK_APPID, this,
                  getApplicationContext(), new String[] { FACEBOOK_PERMISSION }); 
      }
  </code></pre>