title: OnActivityResult() Intent data is always null with no reason
body: <h1>First of all:</h1>
  
  <p><strong>ALL of the answers of the related questions did not solved my problem, thats why i am creating a new question.</strong></p>
  
  <h1>Explanation:</h1>
  
  <p>I have a huge android app, i use Eclipse-ADT plugin and i am using a smartphone that have android 4.0.4 to do the tests, i have a lot of Activity's and i pass values between Activity's via <code>Bundle getExtras</code> in <code>onCreate()</code> and too i get some values on <code>onActivityResult</code>'s.</p>
  
  <h2>Obs:</h2>
  
  <p><strong>(1)</strong> = Activity A that calls for result -> Activity B</p>
  
  <p><strong>(2)</strong> = Activity B that get values from Activity A and returns other values to -> Activity A.</p>
  
  <h1>Problem:</h1>
  
  <ol>
  <li>I have <strong>ProdutosForm.java</strong>(1) activity and <strong>PedidoItemx.java</strong>(2) activity.</li>
  <li>Inside <strong>ProdutosForm.java</strong>(1), i am starting <strong>PedidoItemx.java</strong>(2) activity to get a result:</li>
  </ol>
  
  <h1>Code for item 2:</h1>
  
  <pre><code>&lt;!-- language: lang-java --&gt;
  
  Intent i = new Intent();
  i.setClass(this, PedidoItemx.class);
  i.putExtra("CODE", code );
  
  ...
  ... (a LOT of putExtras....)
  ...
  
  //and after putExtras, thats the relevant part
  startActivityForResult(i, 1); //i its the Intent setted as PedidoItemx.class
  </code></pre>
  
  <ol start="3">
  <li>Inside <strong>PedidoItemx.java</strong>(2) <code>onCreate</code> method i have:</li>
  </ol>
  
  <h1>Code for item 3:</h1>
  
  <pre><code>&lt;!-- language: lang-java --&gt;
  
  Bundle extras    = getIntent().getExtras();
  code             = extras.getString("CODE");
  </code></pre>
  
  <p>4. Too, still inside <strong>PedidoItemx.java</strong>(2) i set some new values and i set the result to RESULT_OK:</p>
  
  <h1>Code for item 4</h1>
  
  <pre><code>&lt;!-- language: lang-java --&gt;
  
  Intent i = getIntent();
  i.putExtra("PEDIDO", cPedPedido);
  i.putExtra("VLRFRETE", valorFrete);
  setResult(RESULT_OK, i); //RESULT_OK is a native constant that have value -1
  finish();
  </code></pre>
  
  <ol start="5">
  <li>Now, returning to <strong>ProdutosForm.java</strong>(1) i have the following onActivityResult code to get the values returned by <strong>PedidoItemx.java</strong>(2):</li>
  </ol>
  
  <h1>Code for item 5:</h1>
  
  <pre><code>&lt;!-- language: lang-java --&gt;
  
  public void onActivityResult(int requestCode,int resultCode,Intent data){
      if(resultCode==RESULT_OK &amp;&amp; requestCode==1){
        Bundle MBuddle = data.getExtras();
        Intent i = getIntent();
        String cPedidoExtra = MBuddle.getString("PEDIDO");
        i.putExtra("PEDIDO", cPedidoExtra);
        i.putExtra("VLRFRETE", MBuddle.getFloat("VLRFRETE", 0));
        cPedPedido = cPedidoExtra; //this does nothing important
        setResult(RESULT_OK, i);
      }
  }
  </code></pre>
  
  <ol start="6">
  <li>Everything looks OK and should work, but it doesn't. <strong>BECAUSE  my <code>requestCode</code> is always <code>0</code> and my <code>data</code> is always <code>null</code></strong> thats the real problem.</li>
  </ol>
  
  <h1>My manifest:</h1>
  
  <pre><code>&lt;!-- language: lang-xml --&gt;
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="bee.mobile"
      android:versionCode="2"
      android:versionName="1.50" &gt;
      &lt;uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" /&gt;
      &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" /&gt; 
      &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /&gt;
      &lt;uses-permission android:name="android.permission.ACCOUNT_MANAGER" /&gt;           
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
      &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt;
      &lt;!-- &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt; --&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name" 
          android:screenOrientation="user"
          android:debuggable="true"&gt; &lt;!-- mudar para false ao gerar depois --&gt;
  
          &lt;activity
              android:name="bee.mobile.form.outros.SplashActivity"
              android:label="@string/app_name"            
              android:screenOrientation="sensor"&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;!-- Outros --&gt;
          &lt;activity android:name="bee.mobile.form.outros.MainActivity"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.HistoricoClienteForm"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.HistoricoListaNotasForm"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.HistoricoNotaForm"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.HistoricoProdutoForm"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.HistoricoMesProdForm"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.HistoricoQuemForm"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.PedidoItemx"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.RelatoriosForm"/&gt;
          &lt;activity android:name="bee.mobile.form.outros.EstufaDetalhes"
              android:windowSoftInputMode="stateHidden"/&gt;
          &lt;!-- Lista --&gt;             
          &lt;activity android:name="bee.mobile.form.lista.ClientesForm"/&gt;
          &lt;activity android:name="bee.mobile.form.lista.ProdutosForm"/&gt;
          &lt;activity android:name="bee.mobile.form.lista.PedidoListaForm"/&gt;
          &lt;activity android:name="bee.mobile.form.lista.ContatosListaForm"/&gt;
          &lt;activity android:name="bee.mobile.form.lista.GruposForm"/&gt;
          &lt;activity android:name="bee.mobile.form.lista.NotaListaForm"/&gt;
          &lt;!-- Cadastro --&gt;
          &lt;activity android:name="bee.mobile.form.cadastro.PedidoCadForm"/&gt;
          &lt;activity android:name="bee.mobile.form.cadastro.ClientesCadastroForm"
              android:windowSoftInputMode="stateHidden"/&gt;        
          &lt;activity android:name="bee.mobile.form.cadastro.ContatosCadForm"
              android:windowSoftInputMode="stateHidden"/&gt;
          &lt;activity android:name="bee.mobile.form.cadastro.PedidoCadForm_Financeiro"/&gt;
          &lt;!-- Sem destino --&gt;        
          &lt;activity android:name="bee.mobile.ConfigurarForm"/&gt;
          &lt;activity android:name="bee.mobile.ConfiguracaoLocalForm"/&gt;
          &lt;activity android:name="bee.mobile.AtualizaManual"/&gt;                        
          &lt;activity android:name="bee.mobile.ReceberForm"/&gt;                              
          &lt;activity android:name="bee.mobile.ResolucaoForm"/&gt;
          &lt;activity android:name="bee.mobile.AtualizarForm"/&gt;
          &lt;activity android:name="bee.mobile.ParticipantesVendaForm"/&gt;       
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <h1>Question:</h1>
  
  <p>Why i cant get the data returned from Activity B?? i am doing something wrong? </p>