Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get request code from an intent object android [closed]

Tags:

java

android

can anyone tell how can we get the requestcode from an Intent which we passed from another activity??

like image 289
Priyesh Avatar asked Jan 13 '23 03:01

Priyesh


1 Answers

If you do

intent.putExtra("requestCode", requestCode);

You can get it by doing:

int requestCode = getIntent().getExtras().getInt("requestCode");

Or

If you do startActivityForResult like this:

startActivityForResult(intent, requestCode);

The request code is there as parameter:

protected void onActivityResult(int requestCode, int resultCode, Intent data)
like image 71
pt2121 Avatar answered Jan 31 '23 20:01

pt2121