Posts

Showing posts with the label display Notification

Notification with expandable custom layout

Image
Android Notification using custom layout with Text & Image In this tutorial we will do the followings: 1) Make/Show Notification (expandable) 2) Custom layout xml for notification 3) Image and Text in custom layout Video Step 1:  Create a new project   OR   Open your project Step 2: In res folder create two resource layout files named custom_normal.xml and custom_expanded.xml Step 3: Place an image in drawable folder to show in notification Step 4: Code: custom_normal.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "match_parent" android:layout_height= "match_parent" android:orientation= "horizontal" > <ImageView android:layout_width= "40dp" android:layout_height= "40dp" android:src= "@drawable/logo_atif" /> ...

Notification with action buttons - Java

Image
Show Notification, Add action button, handle button clicks In this tutorial we will learn the followings: ✓How to show notifications ✓How to add action buttons in notification ✓Handle action button clicks Video: Step 1:  Create a new project   OR   Open your project Step 2: Create two activities 1) LikeActivity 2) DislikeActivity Step 3: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" tools:context= ".MainActivity" > <Button android:id= "@+id/showNotificationBtn" android:layout_width= "wrap_content" and...

Show Notifications on any device - Java

Image
Working with android notifications using Android Studio and Java In this video we will simply show notification on clicking of button. The notification will work on any Android OS. Video Step 1:  Create a new project   OR   Open your project Step 2: Code: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" tools:context= ".MainActivity" > <Button android:id= "@+id/showNotificationBtn" android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:text= "Show Notification...

The Big View Notification - Android Studio

Image
In this tutorial we will see how to display a big view notification having title, icon, multiple lines etc. When button is clicked notification will be displayed and when we click notification it will open an activity. Step 1:  Create a new project  OR  Open your project Step 2: Place an icon in res>drawable folder Step 3: Code activity_main.xml <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:orientation= "vertical" android:padding= "10dp" tools:context= ".MainActivity" > <Button android:id= "@+id/btnShowNotif" android:text= "Show Notification" android:layout_width= "match_parent" android:layout_height= "wrap_content" /> </L...