title: Mapview fragment type mismatch error
body: <p>I am trying to <code>define</code> a fragment with a <code>mapview</code>.
  My <code>xml</code> file is:</p>
  
  <p><strong>fragment_first.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"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;!--android:background="@android:color/holo_orange_dark" &gt;--&gt;
  
      &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      class="com.google.android.gms.maps.SupportMapFragment" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and the <code>java</code> code is:</p>
  
  <p><strong>FirstFragment.java</strong>(copied from google's repo)</p>
  
  <pre><code>public class FirstFragment extends FragmentActivity
          implements OnMapReadyCallback {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.fragment_first);
  
          SupportMapFragment mapFragment =
                  (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
          mapFragment.getMapAsync(this);
      }
  
      /**
       * This is where we can add markers or lines, add listeners or move the camera. In this case,
       * we
       * just add a marker near Africa.
       */
      @Override
      public void onMapReady(GoogleMap map) {
          map.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
      }
  }
  </code></pre>
  
  <p>Now, I am calling this fragment to my <strong>MainActivity</strong> as:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity{
   ...
      private class MyPagerAdapter extends FragmentPagerAdapter {
  
          public MyPagerAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int pos) {
              switch (pos) {
  
                  case 0:
                      return FirstFragment.onMapReady();
  
                  default:
                      return ThirdFragment.newInstance("ThirdFragment, Default");
              }
          }
  
          @Override
          public int getCount() {
              return 5;
          }
      }
  }
  </code></pre>
  
  <p>which is giving me compile time error:</p>
  
  <blockquote>
    <p>Error:(105, 41) error: method onMapReady in class FirstFragment cannot
    be applied to given types; required: GoogleMap found: no arguments
    reason: actual and formal argument lists differ in length</p>
  </blockquote>
  
  <p>What I am going wrong here? One part is obvious about the activity's argument, which I still need to figure out. But what is the error:</p>
  
  <blockquote>
    <p>Non-static Method OnMapReady(...) can not be referenced from a static
    context</p>
  </blockquote>
  
  <p>Kindly help.</p>