Unit 3 AndroidAD
Unit 3 AndroidAD
1. Write a short note on the Drawable class in Android with a suitable example.
2. State and explain the MediaPlayer class along with predefined methods.
3. What is a Gesture class in Android? Explain multiple touches, swipe, drag,
recording, zoom, etc., in detail.
4. Difference between Background Service and Foreground Service in Android
applications.
5. What is a Service? Explain the service lifecycle with a suitable example.
6. Difference between Thread and Process in Android.
7. Write a short note on JobScheduler and Asynchronous tasks.
8. What is an APK? How to build and execute an APK? Explain the process steps
in detail.
9. State and explain the steps for deploying an Android application on Google
Play Publishing an Application
10.What is the Android Animation class? Explain categories of animations in
Android.
11. Write a short note on GPS tracker in Android.
Drawable
Resources
Files Description
Nine-Patch A PNG file with stretchable regions to allow image resizing based on
File content (.9.png)
Drawable
Resources
Files Description
Transition An XML file that defines a drawable that can cross-fade between two
Drawable drawable resources.
Clip An XML file that defines a drawable that clips another Drawable based
Drawable on this Drawable’s current level value.
Scale An XML file that defines a drawable that changes the size of another
Drawable Drawable based on its current level value.
Shape An XML file that defines a geometric shape, including colors and
Drawable gradients.
Step 3: When you click on the Drawable resource file a dialog box will open
on your compute screen. Enter the file name in the text box and then click
on OK.
Step 4: After that the drawable resource XML file will be created and one can
find the file in app > res > drawable as shown in the figure below. In this case,
we have named the file as round_button as shown in the above image.
Step 5: Now click on the file name and one can customize the views by writing
the necessary codes inside this file.
.
2) State and explain the MediaPlayer class along with predefined methods.
MediaPlayer Class in Android is used to play media files. Those are Audio and
Video files. It can also be used to play audio or video streams over the network.
So in this article, the things discussed are:
MediaPlayer State diagram
Creating a simple audio player using MediaPlayer API. Have a look at the
following image. Note that we are going to implement this project using
the Kotlin language.
State Diagram of the MediaPlayer Class
The playing of the audio or video file using MediaPlayer is done using a
state machine.
The following image is the MediaPlayer state diagram.
In the above MediaPlayer state diagram, the oval shape represents the
state of the MediaPlayer instance resides in.
There are two types of arcs showing in the state diagram. One with the single
arrowhead represents the synchronous method calls of the MediaPlayer instance
and one with the double arrowhead represents the asynchronous calls.
The release method which is one of the important element in the
MediaPlayer API. This helps in releasing the Memory resources allocated
for the Mediaplayer instance when it is not needed anymore.
If the stop() method is called using Mediaplayer instance, then it needs to
prepared for the next playback.
The MediaPlayer can be moved to the specific time position
using seekTo() method so that the MediaPlayer instance can continue
playing the Audio or Video playback from that specified position.
The following image is the summarised version of the MediaPlayer state
diagram.
A process has its own Thread has Parents’ PCB, its own
Process Control Block, Thread Control Block, and Stack and
Stack, and Address Space. common Address space.
@Override
protected void onPostExecute(String result) {
// Update UI after task is complete
textView.setText(result);
}
}
new DownloadTask().execute("https://example.com");
In the example above, AsyncTask executes a network operation
(doInBackground) and updates the UI (onPostExecute) once the task is
complete.
o signingConfigs {
o release {
o storeFile file("path/to/my-release-key.jks")
o storePassword "your_store_password"
o keyAlias "my-key-alias"
o keyPassword "your_key_password"
o }
o }
o }
o signingConfigs {
o release {
o storeFile file("path/to/your/keystore/my-release-
key.jks")
o storePassword "your_store_password"
o keyAlias "my-key-alias"
o keyPassword "your_key_password"
o }
o }
o }
o Enter a title for your app (this will be displayed on the Play
Store).
3. Provide App Details:
o Description: Write a short and long description that explains
what your app does.
o Screenshots: Upload high-quality screenshots that
demonstrate your app’s features. The Play Store typically
requires at least two screenshots.
o Feature Graphic: This is a promotional image that appears
at the top of your app’s listing on the Play Store.
o Category: Select the category that best fits your app (e.g.,
Education, Health, Entertainment).
o Content Rating: Complete the content rating questionnaire
so that your app is appropriately rated for different
audiences.
4. Prepare Pricing and Distribution:
o Pricing: Select whether your app will be free or paid. If it’s
paid, you’ll need to set a price.
o Countries: Select the countries where you want your app to
be available.
o Distribute to Specific Devices: If needed, you can restrict
your app’s availability to certain devices (e.g., only tablets
or specific screen sizes).
5. Privacy Policy:
o If your app collects any user data (including location,
contacts, or personal information), you must provide a
Privacy Policy. This policy should be accessible from within
your app and included in the store listing.
4. Upload the APK or AAB
Now that you have your app’s details filled in, you need to upload the
signed APK or AAB file to the Google Play Console.
1. Navigate to the "App releases" section of the Play Console.
2. Create a new release:
o Select Production (for the main version of the app) or
Beta/Alpha (for testing).
o Click on Create Release.
3. Drawable Animation
Drawable Animation is used if you want to animate one image over
another. The simple way to understand is to animate drawable is to load
the series of drawable one after another to create an animation. A
simple example of drawable animation can be seen in many apps Splash
screen on apps logo animation.
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to
Create/Start a New Project in Android Studio.
Select Java/Kotlin as the programming language.
Step 2: Working with the strings.xml file
Navigate to app > res > values > strings.xml and the below code into
the file. Follow the gate to the file.