title: What should I use in place of getWidth() and getHeight() to know when width is greater and when height is greater
body: <pre><code>import android.app.Fragment;
  import android.app.FragmentManager;
  import android.app.FragmentTransaction;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.Display;
  import android.view.WindowManager;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          FragmentManager fm=getFragmentManager();
          FragmentTransaction ft= fm.beginTransaction();
  
  
          WindowManager wm= getWindowManager();
          Display d=wm.getDefaultDisplay();
  
          if (d.getWidth()&gt;d.getHeight())
          {
              Fragment1 f1 = new Fragment1();
              ft.replace(android.R.id.content, f1);
          }
          else
          {
              Fragment2 f2 = new Fragment2();
              ft.replace(android.R.id.content, f2);
          }
      ft.commit();
      }
  }
  </code></pre>
  
  <p>I am trying to use fragments in android and want to display <code>fragment1</code> when width of display is greater than height of display and <code>fragment2</code> when height of display is greater than  width of display but when using <code>getWidth()</code> and <code>getHeight()</code> android studio is saying that these methods are depricated. 
  Then how to know when width is greater and when height is greater?</p>