I am developing an application which shows a custom listview of notes and a Button for adding a new note. When user clicks on button, app shows a full screen dialog to add note with some additional detail. User can also upload an attachment with note as clicking on attachment button. but the problem is after Android M(API 23) this task requires runtime permission.
According to Google Developers, result of permission request will be delivered in onRequestPermissionsResult() method. I don't know how can I get this result in method which I used to show fullscreen dialog.
This is how my method looks like:
private void showCreateNoteDialog() {
//create dialog body...
final Dialog createDialog = new Dialog(NotesActivity.this,R.style.MyFullscreenDialog);
createDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
LayoutInflater inflater = this.getLayoutInflater();
createDialog.setContentView(inflater.inflate(R.layout.customdialog_createNote, null));
createDialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);}
Edit :
The permission require for uploading a file is Read from Sd card or External storage