You may need to take a course on Java
in general before you start jumping into Android
which far more complex. Every argument for requestPermissions
is not valid Java
activity: this
is not valid Java
. Just use this
.
string[]{Manifest.permission.RECORD_AUDIO}
is not valid Java
. Change it to this
new String[]{Manifest.permission.RECORD_AUDIO}
requestCode.1
is not valid Java
just use 1
The end result should be this
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, 1);
solved Why getting errors in android studio when adding code to the main activity xml? [closed]