- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34494 Articles for Programming
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
3K+ Views
Before getting into NotificationCompact.Builder, we should know what is a notification in android. Notification is just like as a message showing system on the action bar. just like missed call notification as shown belowThis example demonstrates how to integrate Android Notification.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project, and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.annotation.SuppressLint; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
6K+ Views
Each date of birth corresponds to a given Zodiac sign. A table that demonstrates these signs and their corresponding dates is given below −Zodiac SignDateAriesMarch 21 - April 19TaurusApril 20 - May 20GeminiMay 21 - June 20CancerJune 21 - July 22LeoJuly 23 - August 22VirgoAugust 23 - September 22LibraSeptember 23 - October 22ScorpioOctober 23 - November 21SagittariusNovember 22 - December 21CapricornDecember 22 - January 19AquariusJanuary 20 - February 18PiscesFebruary 19 - March 20A program that displays the Astrological sign or Zodiac sign for a given date of birth is given as follows.Example Live Demopublic class Example { public static void ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
3K+ Views
Literals with a leading zero are octal literals. Any number prefixed with a 0 is considered octal. Octal numbers can only use digits 0-7, just like decimal can use 0-9, and binary can use 0-1. To define integer literals as octal value in Java is effortless. Here is the declaration and initialization. int myOct = 023; Example Live Demo public class Demo { public static void main(String []args) { int myOct = 023; System.out.println(myOct); } } Output 19 Let us see another example. Example Live Demo public class Demo { public static void main(String []args) { int myOct = 010; System.out.println(myOct); } } Output 8
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
3K+ Views
Before getting into alert dialog, we should know about what is alert dialog, Alert dialog is just like a pop-up where user can choose action by clicking "ok" or "cancel" button.Methods in Alert DialogsetView(View view) − It used to set custom view to alert dialogsetTitle(CharSequence title) − It is used to set title to alert dialogsetMessage(CharSequence message) − It is simple call as content in alert boxsetIcon(int resId) − it is used to set icon for alert boxsetButton(int whichButton, CharSequence text, Message msg) − It is used to set button for alert dialog as shown below example.getListView() − it is used to ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
887 Views
Hexadecimal literal of type long is represented as − long hexLong = 0XABL; For Hexadecimal, the 0x or 0X is to be placed in the beginning of a number. Note − Digits 10 to 15 are represented by a to f (A to F) in Hexadecimal Example Live Demo public class Demo { public static void main(String []args) { long hexLong = 0XABL; System.out.println("Hexadecimal literal of type long: "+hexLong); } } Output Hexadecimal literal of type long:171
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
12K+ Views
We cant touch background thread to main thread directly so handler is going to collect all events which are available in main thread in a queue and posses this queue to looper class.In android Handler is mainly used to update the main thread from background thread or other than main thread. There are two methods are in handler.Post() − it going to post message from background thread to main thread using looper.sendmessage() − if you want to organize what you have sent to ui (message from background thread) or ui functions. you should use sendMessage().This example demonstrate about how to ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
5K+ Views
For Hexadecimal, the 0x or 0X is to be placed in the beginning of a number. Note − Digits 10 to 15 are represented by a to f (A to F) in Hexadecimal Here are some of the examples of hexadecimal integer literal declared and initialized as int. int one = 0X123; int two = 0xABC; Example Live Demo public class Demo { public static void main(String []args) { int one = 0X123; int two = 0xABC; System.out.println("Hexadecimal: "+one); System.out.println("Hexadecimal: "+two); } } Output Hexadecimal: 291 Hexadecimal: 2748
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
172 Views
Before getting into searchview example, we should know what is search view in android, search view is just like search box in HTML. we can search anything from particular list items.This example demonstrate about how to integrate search view in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. In the above code we are giving search view and listview because search view going to search element from ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
355 Views
The System.out.format is used in Java to format output. Here, let’s say the following is our long. long val = 787890; To format, we have considered the following that justifies the output. System.out.format("%d%n", val); System.out.format("%9d%n", val); System.out.format("%+9d%n", val); System.out.format("%08d%n", val); System.out.format("%, 9d%n", val); The following is the complete example that displays the difference in output as well. Example Live Demo import java.util.Locale; public class Demo { public static void main(String []args) { long val = 787890; System.out.format("%d%n", val); ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
417 Views
To compare two Java long arrays in Java, use Arrays.equals() method. Let’s say we have the following long arrays. long[] arr1 = new long[] { 767, 568, 555, 897, 678 }; long[] arr2 = new long[] { 456, 756, 555, 999, 678}; long[] arr3 = new long[] { 767, 568, 555, 897, 678 }; Now, we can compare the equality of these arrays using the equals() method. Arrays.equals(arr1, arr2); Arrays.equals(arr2, arr3); Arrays.equals(arr1, arr3); The following is the complete example. Example Live Demo import java.util.*; public class Demo { public ... Read More