Hello friends I tell you that I have a problem, I have two buttons one allows me to access the microphone and the other save then I need two permissions, which work well to run the app leaves the sign asking for permission and all the problem is I can not use the buttons until I close and return to run the app I leave the structure I hope I get an orientation that I'm doing wrong.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO}, 1000);
} else {
grabar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "La grabación comenzó", Toast.LENGTH_LONG).show();
}
});
guardar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Se guardo", Toast.LENGTH_LONG).show();
}
});
}
}