title: change activity after a certain time period
body: <p>I am creating app that changes activities after time period, but I can`t make it work. When I run the program I get only black screen. Here is my onCreate method: </p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      context = this;
  activity = 1;
       i = new Intent(context, WeatherActivity.class);
      Handler mHandler = new Handler();
      mHandler.postDelayed(new Runnable() {
  
          @Override
          public void run() {
              while (true){
               if(activity ==1){
                   context.startActivity(i);
                   activity = 0;
               }else if (activity ==0){
                   news();
  
                   activity = 1;
               } try {
                      Thread.sleep(10000);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
          }
  
  
          }
  
      }, 10000L);
  }
  </code></pre>
  
  <p>Activities are just simple activies with just some text. I`ll post them if needed.
  Edit: Made it work by changin activities in methods.</p>