App with ScrollView and HorizontalScrollView having a set of buttons inside it.
- ScrollView
- HorizontalScrollView
- Button
- LinearLayout
- TextView
App with Toolbar having a set of buttons inside it.
- Toolbar
- Button
- RelativeLayout
- TextView
Firstly, Go to res > values > themes.xml(both files) and change the theme from DarkActionBar to NoActionBar otherwise the app may crash.
App with RatingBar and a submit button which display a toast clicked on it
- RatingBar
- Button
- RelativeLayout
- TextView
App with Splash Screen. Splash Screen is a screen which is displayed when the app is launched. It is used to display the logo of the app or some other information for a short period of time.
- Handler
- Runnable
- Intent
- RelativeLayout
App with a button that shows a Custom Toast when click on it. Custom Toast is a toast which is displayed with a custom layout.
- Toast
- Button
- ConstraintLayout
App with a button that shows a Progress Bar when click on it. Progress Bar is a bar which is displayed to show the progress of some task.
- ProgressBar
- Button
- ConstraintLayout
Footer is also known as Bottom Navigation Bar. It is a bar which is displayed at the bottom of the screen. It is used to navigate between different activities or fragments. In this app, we have a footer with 4 items. When we click on any item, the textView is changed to the name of the item.
- BottomNavigationView
- TextView
- ConstrainLayout
- Menu
App with an edit text and a button. When we enter the time in the edit text and click on the button, the alarm is set for that time. When the alarm is triggered, a toast is displayed and the alarm is played. We can cancel the alarm by clicking on the cancel button. We can create a repeating alarm by clicking on the repeating button.
- AlarmManager
- PendingIntent
- BroadcastReceiver
- Intent
- EditText
- Button
Add a ringtone in the raw folder.
Add a permission in the manifest file under the application tag.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Add a receiver with the name same as class name of the BroadcastReceiver in the manifest file under the application tag.
<receiver android:name=".AlarmManagerBroadcast" />
App with a button that shows a Job Scheduler when click on it. Job Scheduler is a service which is used to perform some task at a specific time. In this app, we have a button which starts the job scheduler. When the job scheduler is triggered, a toast is displayed and the alarm is played. We can cancel the job scheduler by clicking on the stop job button.
- JobScheduler
- JobService
- AlarmManager
- PendingIntent
- BroadcastReceiver
Add AlarmManagerBroadcast and all permissions in manifest file from the above example.
Add a service with the name same as class name of the JobService in the manifest file under the application tag.
<service
android:name=".MyJobService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
App with a button that shows a Notification when click on it. Notification is a message which is displayed outside the app. When the user clicks on the notification, the app is opened and the user is taken to the activity which is specified in the intent and shown the message.
- Notification
- NotificationManager
- NotificationChannel
- PendingIntent
- Intent
- Builder
XML Codes | Kotlin Codes | Output |
---|---|---|
1'st activity | 1'st activity | |
2'nd activity | 2'nd activity | Output Screenshot |
App with two fragments in a single activity. The first fragment is having a set of buttons for sending text, clear text and changing background colour of the second fragment.
- Fragment
- FragmentManager
- FragmentTransaction
- Button
- TextView
XML Codes | Kotlin Codes | Output |
---|---|---|
Main activity | Main activity | |
1'st fragment | 1'st fragment | |
2'nd fragment | 2'nd fragment | Output Screenshot |
Text Interface | ||
Color Interface |
App with two fragments in a single activity. The first fragment is having a list of items. When we click on any item, the second fragment is displayed with the name of the item. It also shows how to pass data from one fragment to another fragment.
- Fragment
- FragmentManager
- ListView
- Button
- TextView
XML Codes | Kotlin Codes | Output |
---|---|---|
Main activity | Main activity | |
1'st fragment | 1'st fragment | Output Screenshot |
2'nd fragment | 2'nd fragment |
App with two fragments. The fragments are displayed depending on the orientation of the device. When the device is in portrait mode, the first fragment is displayed. When the device is in landscape mode, the second fragment is displayed.
- Fragment
- FragmentManager
- FragmentTransaction
- Orientation
- Button
- TextView
XML Codes | Kotlin Codes | Output |
---|---|---|
Main activity | Main activity | |
1'st fragment | 1'st fragment | Output Screenshot |
2'nd fragment | 2'nd fragment |
App with a custom view. The activity is having a custom views as a rectange and three arc which is making a fan shape. When user tap on it, then the fan translates which seems like a fan is rotating.
- CustomView
- Canvas
- Paint
- Path
App that allows the user to draw on the screen. It has a button to clear the canvas.
- Canvas
- Paint
- Path
- Button
App with a date picker. When user selects a date, the date is displayed as a toast message.
- DatePicker
- Button
- Toast
App with a time picker. When user selects a time, the time is displayed as a toast message.
- TimePicker
- Button
- Toast