I want to sent intent from one first activity to another.
The first activity sends an intent to the second activity in order to create a new AlertDialog, receive a n
in onActivityResult you are not suppposed to call
intent = getIntent();
directly you have got the
protected void onActivityResult(int requestCode, int resultCode, Intent data)
where data corresponds to the data sent from the alert box activity. Just directly calling
data.getIntExtra("data2", -1);
should do. Hope I was clear enough.
Try
Bundle extra=data.getExtras();
Insted of
Bundle extra=getIntent().getExtras();
try this way
int data1,data2;
Bundle extra=getIntent().getExtras();
if(extra!=null){
data1=extra.getInt("data1");
data2=extra.getInt("data2");
}
try with this.
Bundle extras = getIntent().getExtras();
int a=extras.getInt("data1");