Changes

Jump to: navigation, search
m
Text replacement - "<google>BUY_ANDROID_STUDIO6</google>" to "<htmlet>androidstudio_a6</htmlet>"
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
Create a new project in Android Studio, entering AudioApp into the Application name field and ebookfrenzy.com as the Company Domain setting before clicking on the Next button.
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
On the form factors screen, enable the Phone and Tablet option and set the minimum SDK setting to API 8: Android 2.2 (Froyo). Continue to proceed through the screens, requesting the creation of an empty activity named AudioAppActivity with a corresponding layout resource file named activity_audio_app.
}
</pre>
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
The added code begins by obtaining references to the three button views in the user interface. Next, the previously implemented hasMicrophone() method is called to ascertain whether the device includes a microphone. If it does not, all the buttons are disabled, otherwise only the Stop and Play buttons are disabled.
.
</pre>
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
Next, a method needs to be added to the class, the purpose of which is to take as arguments the permission to be requested and the corresponding request identification code. Remaining with the AudioAppActivity.java class file, implement this method as follows:
}
</pre>
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>
The above code checks the request identifier code to identify which permission request has returned before checking whether or not the corresponding permission was granted. In the event that permission was denied, a message is displayed to the user indicating the app will not function. In both instances, the record button is also disabled.
All that remains prior to testing the app is to call the newly added requestPermission() method for each of the required permissions when the app launches. Remaining in the AudioAppActivity.java file, modify the onCreate() method as follows:
<googlehtmlet>BUY_ANDROID_STUDIO6androidstudio_a6</googlehtmlet>

Navigation menu