I have a code to get get a audio from storage and save the uri to the audio selected.
Also I want to pass an additional parameter TimeZoneOfDay
with the intent.
here is the code to do that
Intent intent_upload = new Intent();
intent_upload.setType("audio/*");
intent_upload.putExtra(TimeZoneOfDay,2);
// Bundle b = new Bundle();
//b.putInt(TimeZoneOfDay,2);
intent_upload.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent_upload,1);
@Override
protected void onActivityResult(int requestCode,int resultCode,Intent data){
Log.e(Tag, "Onactivity result called");
if(requestCode == 1){
Toast.makeText(this, "file choosen",Toast.LENGTH_SHORT).show();
if(resultCode == RESULT_OK){
Uri uri = data.getData();
Bundle b = data.getExtras();
Log.e(Tag, "dcs "+data.hasExtra(TimeZoneOfDay)+ String.valueOf(b!=null));
I also want to put an extra in my intent TimeZoneofDay.
However, data.hasExtra(Timezone)
is showing false
and data.getExtras()
is null
.
How to properly pass the parameter TimeZoneOfDay
?