Created
June 14, 2017 04:32
-
-
Save haidong94/e2ead0311e746759803556adc4b4bb7d to your computer and use it in GitHub Desktop.
code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final static int RQS_RECORDING = 1; | |
Uri savedUri; | |
Button buttonRecord; | |
@Override public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_test); | |
buttonRecord = (Button) findViewById(R.id.record); | |
buttonRecord.setOnClickListener(new Button.OnClickListener() { | |
@Override | |
public void onClick(View arg0) { | |
// TODO Auto-generated method stub | |
Intent intent = new Intent( | |
MediaStore.Audio.Media.RECORD_SOUND_ACTION); | |
startActivityForResult(intent, RQS_RECORDING); | |
} | |
}); | |
} | |
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
// TODO Auto-generated method stub | |
if (requestCode == RQS_RECORDING) { | |
savedUri = data.getData(); | |
Toast.makeText(MainActivity.this, | |
"Saved: " + savedUri.getPath(), Toast.LENGTH_LONG).show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment