Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

How to Implement Callback in Android to Communicate Between Classes & Fragments

Callback is a way to inform a class synchronous/ asynchronous when an event occurs. A simple way to create a generic callback is to use interface with a method in which JSON is passed.     So, In this tutorial, I will guide...

How to Detect Network Connectivity Using Observer in Android Device

If you want to check whether your device connected to Internet or not OR when it turn on/off then adding the observer is the best way. You have to add the observer in activity to check connection is on or off.     Let's...

How to Implement Room Database in Android using RxJava2?

The Room is basically an easier implementation of SQLite database and a part of Android Architecture components. We know that SQLite uses SQLite open helper class to manage SQLite database but Room provides migration by removing this implement...

Big View Notification - How to Apply Expanded Layout to Android Notification

There are two types of visual style which appear on the Notification, normal view and big view. So, here in this tutorial, we will see how to Apply Expanded Layout to Android Notification. Regarding Nig View Notification, you should aware tha...

How hashMap internally works in java ?

It’s not wrong to say that HashMap is an implementation of Map interface as it allows value storing in key value pairs. Although unique elements are present in Hashmap, null values and only one null key are allowed. Hashmap basically wor...

Data structure when to use what ?

We have different types of data structures like array, linked list, tree etc but which one is better so this is basic question that comes in mind every time when we have large data set. In this post we can find out the best data structure type...

Convert bytes to human readable form Android Java

Convert bytes data to human readable form. 1.  I initialized the byte with random number; long bytes = 123456; 2.  Initialize String[] of data types. String[] types = {"kb", "Mb", "GB", "TB", "PB", "EB"}; 3. initial...

How to use Custom Exception in android

Custom Exception is user-defined exception. It is used to customize the exception according to the user requirement. Here In step one we have defined own exception . In step second Using the custome defined exception extends "Exception"...

What is Daemon thread in java ?

In java any thread can be a Daemon thread. Basically daemon thread are those that works in background to support or to provide services for users threads running in same process. If there are no any user threads available while daemon threads ...

Sting Builder vs String Buffer in java

We know that Strings are immutable or constants but String builder and String buffer are basically used to provide dynamic implementation of Strings. But String Builder is not thread safe that means more than one process can access or modify t...

What is anonymous inner class in java and how to implement interface in annonymous class ?

Anonymous means no name, a class with no name called as Anonymous class. But is has advantage like to create an instance of class in one step. We can'e create an object of this class since it has no name. An anonymous class can implemen...

Transient varialbe in java

We know that serialization is the process that converts java objects or data into bytes stream on one end and on other end we deserialize it that means convert bytes into orignal data.   Serialization means to save data after serializa...

Deletion of node from binary search tree in java

Like a linked list we can also delete a node from binary search tree. This operation perform O(log(n)) time complexity. Here is an example of deletion : private TreeNode delete(TreeNode rootNode, int k) { // create a node to store tem...

Binary search tree insert item implementation in java

Binary search tree is an extension of linked list data structure that contains node. Insertion in tree is easy. This tree contains a root and child node where left hand sided node always lesser than parent node and right hand sided node always ha...

Queue implementation using linkedlist in java

We know that linkedlist is type of Data structure using linked list we can store item of same type. Queue can be also be implemented using linkedlist. In this example we have two node that are head(Front) and trail(rear) where we can insert...

Queue implementation using Array in java

Queue is a kind of Abstract data structure that holds items in same order. Queue follow FIFO mechanism for operations like insertion and deletion of items. Note : - One end is always used to insert data called enqueue. - Other end is alw...

traverse and reverse double linked list in java

Traverse and reverse a linked list takes time complexity of O(n). Traverse a double linked list requires only node next reference until it reach to trail or null value : public void traverseLinkedList(){ Node<T> tempNode = st...

Deletion in double linkedlist in java

Deletion of item from double linked list st known position takes O(1) complexity while deletion at some specified position takes O(n) time complexity. In deletion we basically removes the pointer of that item. First of all check the reference ...

Insertion in double linked list in java

Double linked list is a type of data structure that contains data in linear way but its different from single linked list because we can traverse in both direction in list. This provides previous and next pointer and node value. Insertion in d...

How to reverse linkedlist in java ?

There are two way to reverse a linked list that are using recursion or using iteration. This operation takes O(n) time complexity during iteration method. Here is the code to reverse linked list using iterator : public void reverseLinked...

How to merge linked list in java

If we have two sorted linked list and we want to merge both in a new list without creating new node space then we can use recursive approach for this . This approach takes O(max(m,n)) time complexity for merging. Like we have a linked list nam...

Deletionin linkedlist in java

A linked list is type of data structure that contains items in linear order. Deleting an item from linked list performs O(n) time complexity. you can perform two type of deletion from linked list either you can delete first item of list or in any...

How to rename a file in android

Below is the code to rename a file, in this code newdirectory is the path where the file is existing . The Boolean done will give true value if the file get renamed. String PIC_FILE_NAME="hello.png"; String UPDATED_PIC_FILE="world.png"; Fi...

Compare two Date object in Java

Sometime we need two compare two dates like which Date object's time coming first or last. Here is the code to compare two dates. Date date1; Date date2; if(date1.before(date2)){ System.out.println("Date 1 is before date ...

To create database and insert data in SQLite, in android

If you are looking for the code in android to create database and insert data in SQLite then follow the steps mentioned below:- 1) Create a layout in which the data will be filled that will be inserted into database. activity_signup_form....

How to know the call state in Android

Android provide us the facility to know the call state. Android gives this feature by providing Telephonymanager class. We need to implement PhoneStateListener interface that has one method onCallStateChanged(). Below is the example. publ...

Email validation using regex

Email validation using regex The Email Id such as adam.sandler@findnerd.com is made up of local-part, an @ symbol and then a domain part. Hence, Email Id is of the form : local_part@domain *TLD = Top Level Domain Some Valid Emails ...
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: