title: How to implement MapView V2 in normal Activity with java?
body: <p>due to some limitations in my framework, i need to implement an android app without using xml layouts, i need to do it using java code only.</p>
  
  <p>Also i need to implement this map in a simple Activity, i mean my activity must extend Activity, and not other kind of extended activity. This is also due some limitations in my framework.</p>
  
  <p>I searched in google and stackoverflow and i just find only some answers and code example of how to do it extending FragmentActivity and MapActivity, or using xml layouts like here: <a href="https://developers.google.com/maps/documentation/android/start?hl=es" rel="nofollow">https://developers.google.com/maps/documentation/android/start?hl=es</a></p>
  
  <p>The perfect way for my needs will be to do the same you can read in the official documentation linked above, but without the XML file, using just java code. This is the code showed in the link above:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&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"
            android:name="com.google.android.gms.maps.MapFragment"/&gt;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  }
  </code></pre>
  
  <p>I mean i need to transform this into java code:</p>
  
  <pre><code>&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"
            android:name="com.google.android.gms.maps.MapFragment"/&gt;
  </code></pre>