Skip to content

Instantly share code, notes, and snippets.

@Arturo0021
Created September 25, 2018 18:18
Show Gist options
  • Select an option

  • Save Arturo0021/302db3f58ee9df4ecc3311d91d223420 to your computer and use it in GitHub Desktop.

Select an option

Save Arturo0021/302db3f58ee9df4ecc3311d91d223420 to your computer and use it in GitHub Desktop.
AlertDialog.Builder builder = new AlertDialog.Builder(Main_Activity.this);
if(ContextCompat.checkSelfPermission(Main_Activity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED){
builder.setTitle("Permisos");
builder.setMessage("Es Necesario Aceptar Los Siguientes Permisos");
builder.setIcon(R.drawable.ic_launcher_foreground);
builder.setCancelable(false);
builder.setPositiveButton("Continuar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(Main_Activity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
}
});
builder.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment