Android| Intent | PutExtra doesn't work on the retriever side
<p>I wan't to sent intent from one first activity to another.</p>

<p>The first activity sends an intent to the second activity in order to create a new AlertDialog , receive  a number from the user and  send the number back to the first activity, -that's where putExtra data to failed (please continue reading): </p>

<p>The code of the first activity: GuessItActivity.java  </p>

<pre><code>                    Intent intent = new Intent(GuessItActivity.this,
                        AlertDialogMessage.class);
                intent.addFlags(Intent.FILL_IN_DATA);
                intent.addFlags(Intent.FILL_IN_CATEGORIES);
                intent.addFlags(Intent.FILL_IN_ACTION);

                intent.putExtra("data1", 15);
                startActivityForResult(
                        intent,
                        getResources().getInteger(
                                R.integer.ALERT_DIALOG_MESSAGE));
</code></pre>

<p>on the retriever side , e.g the second activity side on  AlertDialogMessage.java</p>

<pre><code>                            public void onClick(DialogInterface dialog,
                                int which) {
                            // "OK" button pressed
                            int userGuess = Integer.parseInt(input
                                    .getText().toString());
                            Intent intent = getIntent();
                            if (intent == null)
                                return;

                            int data1 = intent.getIntExtra("data1", -1);
                            if (data1 != 15 )
                                return; // data1 ==15 

                            intent.putExtra("data2", 25);           
                            if (getParent() == null) {
                                setResult(Activity.RESULT_OK, intent);
                            } else {
                                getParent().setResult(Activity.RESULT_OK,
                                        intent);
                            }
                            finish();
</code></pre>

<p>The first activity side: back to GuessItActivity.java</p>

<pre><code>    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == getResources().getInteger(
            R.integer.ALERT_DIALOG_MESSAGE)) {
        if (resultCode == RESULT_OK) {
            Intent intent = getIntent();
            if (intent==null)
                return; 


              Bundle extra = getIntent().getExtras();
            if (extra != null) {
                int _data1 = extra.getInt("data1");
                int _data2 = extra.getInt("data2");
            }
               // extra  == null , what am I doing wrong  ? 

            int data1 = intent.getIntExtra("data1",-1);
            int data2 = intent.getIntExtra("data2",-1);
            if ((data1==-1)&amp;&amp;(data1==-1))
                return; 
</code></pre>

<p>The problem is , that I receive data1 and data2 equal to -1. </p>

<p>I'd like to receive the data the I put on the second activity. e.g data1 == 15 and data2 == 25</p>

<p>what am I doing wrong ? 
please  help  </p>

<p>S </p>
