title: android.view.inflateException: Binary XML file line #11: Error inflating class fragment
body: <p>Hi I'm a bit new in Android, i'm developing a code that shows and map with some markers. I used 2 button, one for see the map, and other to add information. The problem is that in the first time i have clicked in show map, it show, but when I back to "mainmenu" and clicked again in show map, just apear a black screen and shows this error:  <pre>android.view.inflateException: Binary XML file line #11: Error inflating class fragment </pre></p>
  
  <p>I'm using API 16, and if i'm not wrong I should use MapFragmet like i'm doing, not extends Fragment because it's used in older version, isn't?</p>
  
  <p>My XML:</p>
  
  <p></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity" &gt;
  
      &lt;fragment
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          class="com.google.android.gms.maps.MapFragment"  /&gt;
  
      &lt;ImageView
          android:id="@+id/logo"
          android:layout_width="60dp"
          android:layout_height="60dp"
          android:layout_alignRight="@+id/map"
          android:layout_alignTop="@+id/map"
          android:contentDescription="@string/hintlogo"
          android:src="@drawable/logo" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>My Manifest</p>
  
  <p></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="uri.br.rs"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="11"
          android:targetSdkVersion="16" /&gt;
  
  &lt;!-- Permissão para exibir o mapa --&gt;
      &lt;permission
          android:name="uri.br.rs.permission.MAPS_RECEIVE"
          android:protectionLevel="signature"/&gt;
  
      &lt;uses-permission android:name="uri.br.rs.permission.MAPS_RECEIVE"/&gt;
  
  &lt;!-- Permissão para interner, entre outros --&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/&gt;
  
  &lt;!-- Estas permissões não são necessárias para usar o
           Google Maps Android API v2, mas são recomendadas. --&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
  
  &lt;!-- Permissão para usar o OpenGL --&gt;
      &lt;uses-feature
          android:glEsVersion="0x00020000"
          android:required="true"/&gt;    
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/logo"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
  
  &lt;!-- Chave do Google Maps Android, registrada no site do Google APIs --&gt;
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="some_key"/&gt;
  
  
          &lt;activity
              android:name="uri.br.rs.TudoImoveis"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p></p>
  
  <p>And my class named TudoImoveis:</p>
  
  <p></p>
  
  <pre><code>package uri.br.rs;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import com.google.android.gms.maps.CameraUpdate;
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapFragment;
  import com.google.android.gms.maps.model.BitmapDescriptorFactory;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ImageView;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemClickListener;
  
  public class TudoImoveis extends Activity {
  
      String login = "admin", senha= "admin", loginaux, senhaaux;
      int guardaId;
  // Dados do banco
      SQLiteDatabase bancoDados = null;
      Cursor cursor;
  // Dados do mapa
      GoogleMap map;
      final LatLng stgo = new LatLng(-29.191357,-54.866588);
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Toast.makeText(getApplicationContext(), "On Created!", Toast.LENGTH_LONG).show();
          menuPrincipal(); //chama menu inicial
      }
  
      @Override
        public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.tudo_imoveis, menu);
          return true;
        }
  
  // ---------------------------------------------- Chama a tela inicial ----------------------------------------------
      public void menuPrincipal(){
          setContentView(R.layout.principal);
  
          Button btFechar = (Button) findViewById(R.id.btfechar);
          Button btVer = (Button) findViewById(R.id.btVer);
          Button btAnunciar = (Button) findViewById(R.id.btAnunciar);
          Button btLogar = (Button) findViewById(R.id.btLogar);
          TextView tvlogin = (TextView) findViewById(R.id.tvLogin);
          TextView tvsenha = (TextView) findViewById(R.id.tvSenha);
          EditText etLogin = (EditText) findViewById(R.id.etLogin);
          EditText etSenha = (EditText) findViewById(R.id.etSenha);
  // Deixa login invisível
          tvlogin.setVisibility(View.INVISIBLE);
          tvsenha.setVisibility(View.INVISIBLE);
          etLogin.setVisibility(View.INVISIBLE);
          etSenha.setVisibility(View.INVISIBLE);
          btLogar.setVisibility(View.INVISIBLE);
  // Botão ver
          btVer.setOnClickListener(new View.OnClickListener() {
              public void onClick(View arg0) {
                  abreOuCriaBanco();
                  mostraMapa();
                  Toast.makeText(getApplicationContext(), "Mapa", Toast.LENGTH_SHORT).show();
              }
          });
  // Botão Anunciar
          btAnunciar.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
                  abreOuCriaBanco();
                  logar();                
              }
          });
  // Botão fechar
              btFechar.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View arg0) {
                      sairSistema();
                  }
              });
      }
  
  // ------------------------------------------- Função mostraMapa() ---------------------------------------------------
      public void mostraMapa(){
          try{
          setContentView(R.layout.mapa);
  
          ImageView logo = (ImageView) findViewById(R.id.logo);
  
          map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
          // utiliza-se este método para versões superiores ao Android 3.0 com import da biblioteca
          // import com.google.android.gms.maps.MapFragment;
          CameraUpdate update = CameraUpdateFactory.newLatLngZoom(stgo, 15);
          map.animateCamera(update);
  
  
  // Ao clicar na imagem
          logo.setOnClickListener(new View.OnClickListener() {
              public void onClick(View arg0) {
                  menuPrincipal();
                  //bancoDados.close();
                  Toast.makeText(getApplicationContext(), "Menu Principal", Toast.LENGTH_SHORT).show();
              }
          });
  
  
  // Se não tem dados carrega a casa
              if (buscaDados()==true){
                  map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
                  map.addMarker(new MarkerOptions()
                              .position(new LatLng(-29.187648,-54.864245))
                                  .title("Duque de Caxias, 513, apt. 403")
                                  .icon(BitmapDescriptorFactory.fromResource(R.drawable.casa)));
              }
  // Se tem dados 1º de maneira estática pra ver se funciona
              if (buscaDados()==false){
                  map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
                  map.addMarker(new MarkerOptions()
                                  .position(new LatLng(-29.187648,-54.864245))
                                  .title("Falso, 513, apt. 403")
                                  .icon(BitmapDescriptorFactory.fromResource(R.drawable.casa)));
                  Toast.makeText(getApplicationContext(), "Não existem registros!",Toast.LENGTH_SHORT).show();
              }
  
          }catch (Exception e){Toast.makeText(getApplicationContext(), "Erro: "+e, Toast.LENGTH_SHORT).show();}
  
      }
  </code></pre>
  
  <p></p>