Adapter Pattern

The adapter pattern converts the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.        

Continue reading

ListView

ListView ListView is a view which displays a list of scrollable items. The list items are automatically inserted to the list using an adapter. A lot of information can be displayed As users reach the end, more results are generated and displayed Each row of data is clickable and can perform some action. Adapter An […]

Continue reading

EveryThing About Android’s Runtime Permission

Runtime Permission introduced in android version M. It is one of the major security fixes for Android. Prior to Android Marshmallow, all permissions are asked at installation time, and once the app is installed, it can use all these permissions with any acknowledgement to users. The user is left with the option either to install […]

Continue reading

Basic UI elements

TextView:- It is used to display text. EditView:- It enables one to edit. Button:- It is used to perform the certain task when clicked. ImageView:- To display an image. ImageButton:- This is a button with an image instead by the text. AutoCompleteTextView:- Same as editView plus it shows a list of completion suggestions automatically while […]

Continue reading

Interview Questions Basic Level-3

What is runtime permission? Refer What is Localization in Android? It is the process of rendering the content of an app into other languages and customizing your app for different targets, regions etc. How to localize the App? If we need to support three languages, we have to create three alternatives of strings.xml, each stored […]

Continue reading

Abstract Factory Pattern

Abstract Factory:- Provide an interface for creating families of related or dependent objects without specifying their concrete class. Each generated factory can give the objects as per the Factory pattern. Abstract factory is also called as factory of factories.

Continue reading

Factory Method: Design Pattern

Factory is a building or group of buildings where goods are manufactured. Here we manufacture objects. In Factory pattern, we create object without exposing the creation logic to the client and refer to newly created object using a common interface. Example 1:- Example 2:- See Complete Code   Also read https://www.tutorialspoint.com/design_pattern/factory_pattern.htm  

Continue reading

Facade: Desgin Pattern

Facade:face of Building or A deceptive outward appearance.   The people walking past the road can only see this glass face of the building. They do not know anything about it, the wiring, the pipes and other complexities. It hides all the complexities of the building and displays a friendly face. Def:- It hides the […]

Continue reading

Mediator Pattern : Design Pattern

This pattern provides a mediator class which normally handles all the communications between different classes. Example:- We are demonstrating mediator pattern by the example of a chat room where multiple users can send the message to the chat room, and it is the responsibility of chat room to show the messages to all users.

Continue reading

Observer: Design Pattern

The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. It is used when there is a one-to-many relationship between objects such as if one object is […]

Continue reading

Singleton: Design Pattern

What Singleton design pattern is a pattern in which we can have only one instance of the class. Singletons are used for centralized management of internal or external resources and they provide a global point of access to themselves. Example:- 1) One single DB connection shared between multiple objects. 2) In any in a system, […]

Continue reading

What are indexes in the database?

A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure. Indexes are used to quickly locate data without having to search every row in a database table every time a database […]

Continue reading

SQL wildcard performance comparison?

I am here talking about ‘%’ wild card. Doubly truncated:- %code% Right truncated:- code% Left truncated:- %code No truncated:- code Can you guess, which one is fastest among all? Case a and Case c: If you put ‘%’ on the left side of your search term, SQL server has to examine every single row of […]

Continue reading

Tips to optimize database queries

1) Always select the columns, which are required We have the habit of using ‘*’ all time.

Instead, use,

  2) Limit Sometimes we need few records but request all records from the database. We fetch all data then truncate unwanted records at UI level. We can limit this by adding ‘LIMIT’ in […]

Continue reading

Decoding Complexity

O(1): known as Constant complexity 1 item: 1 second 10 items: 1 second 100 items: 1 second O(n): known as Linear complexity 1 item: 1 second 10 items: 10 seconds 100 items: 100 seconds O(n2): known as Quadratic complexity 1 item: 1 second 10 items: 100 seconds 100 items: 10000 seconds O(log n): known as […]

Continue reading

Complexity of Algorithm

Common Sorting Algorithm Algorithm Time Complexity   Best Average Worst Selection Sort Ω(n^2) θ(n^2) O(n^2) Bubble Sort Ω(n) θ(n^2) O(n^2) Insertion Sort Ω(n) θ(n^2) O(n^2) Heap Sort Ω(n log(n)) θ(n log(n)) O(n log(n)) Quick Sort Ω(n log(n)) θ(n log(n)) O(n^2) Merge Sort Ω(n log(n)) θ(n log(n)) O(n log(n)) Bucket Sort Ω(n+k) θ(n+k) O(n^2) Radix Sort Ω(nk) […]

Continue reading

Data Structure

Data Structure is a way of organization and storing data on the computer so that it can be accessed and modified efficiently. It is the collection of data values and the relationship among them. We can categorized data types in two parts:- Primitive Non-Primitive Primitive Data Type The programming language provides building blocks for storing […]

Continue reading

Annotation

Annotation means “a note by way of explanation or comments added to a text or diagram”. Annotation is Metadata, which conveys some additional information to the compiler. Annotation in Java start with @ Example:- @Override It indicates that you are overriding a method. It assures that the subclass method is overriding the parent class method. […]

Continue reading

Dependency Injection In Android

There are many Libraries for Dependency injection in Android. Few are ButterKnife,Roboguice, Android annotation, dagger 2. Butterknife Official Guide working  example: slidenerd  

Java Annotation is a tag that represents the metadata i.e. attached with class, interface, methods or fields to indicate some additional information which can be used by java compiler and JVM. […]

Continue reading