Posts

Mutable list and Immutable list in kotlin android

  The Kotlin List helps the developer read and write data locally. There are two types of lists available in Kotlin. A list that is used only for reading purposes is called an immutable list. A mutable list is a list where the developer can write data. Lists are part of the Kotlin Collection. Kotlin collections are defined in three forms. These are  Lists ,  Sets  ,  Maps . In this article, we will learn about Kotlin lists and their functionality. To know more about kotlin collection then click the link.  Kotlin Collections come in three primary forms: Lists, Maps, and Sets. Each is a distinct type, with its unique characteristics and use cases. Here they are: Kotlin List A  Kotlin List  is a sequential arrangement of elements that permit duplicate values, preserving the order in which they are added. Elements in a list are accessed by their index, and you can have multiple elements with the same value. Lists are a great help when storing a collection of items whose order needs to be

React Native – Setup

There are a couple of things you need to install to set up the environment for React Native.We will use OSX as our building platform. Install NodeJS and NPM  on UNIX/Linux/Mac OS X, and SunOS : $ cd /tmp $ wget http://nodejs.org/dist/v6.3.1/node-v6.3.1-linux-x64.tar.gz $ tar xvfz node-v6.3.1-linux-x64.tar.gz $ mkdir -p /usr/local/nodejs $ mv node-v6.3.1-linux-x64/* /usr/local/nodejs Add /usr/local/nodejs/bin to the PATH environment variable. Linux : export PATH=$PATH:/usr/local/nodejs/bin Mac   : export PATH=$PATH:/usr/local/nodejs/bin Step 1 – Install Homebrew Open your terminal and run the following code to install Homebrew − /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Step 2 – Install Watchman Run the following code to install Watchman. brew install watchman Step 3 – Install React Native Now, run the following code to install React Native. npm install -g react-native-cli Step 4.1 An

React Native in Android

React Native lets you build mobile apps using only JavaScript. It uses the same design as React, letting you compose a rich mobile UI from declarative components. With React Native, you don't build a mobile web app, an HTML5 app, or a hybrid app. you build a real mobile app that's indistinguishable from an app built using Objective-C or Java.React Native uses the same fundamental UI building blocks as regular iOS and Android apps. You just put those building blocks together using JavaScript and React. React Native Features React - This is a Framework for building web and mobile apps using JavaScript. Native − You can use native components controlled by JavaScript. Platforms – React Native supports IOS and Android platform. React Native Advantages JavaScript − You can use the existing JavaScript knowledge to build native mobile apps. Code sharing − You can share most of your code on different platforms. Community – The community around React and React Native is

Firebase Database Example in Android

Image
What is Firebase :                  The Firebase Realtime Database is a cloud-hosted NoSQL database that lets you store and sync data between your users in realtime.The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. When you build cross-platform apps with our iOS, Android, and JavaScript SDKs, all of your clients share one Realtime Database instance and automatically receive updates with the newest data. NEW: Cloud Firestore (beta) enables to you store, sync and query app data at global scale. Setup Firebase Realtime Database for Android :  There are two ways you can connect your app to Firebase .     1. Install Firebase SDK     2.Using Firebase Console ,add your app to Firebase .   Install Firebase SDK : If you're using the latest version of Android Studio (version 2.2 or later), we recommend using the Firebase Assistant to connect your app to Firebase. The Firebase Assistan

Difference Between Interpreter and Compiler

We generally write a computer program using a high-level language. A high-level language is one which is understandable by us humans. It contains words and phrases from the English (or other) language. But a computer does not understand high-level language. It only understands program written in 0's and 1's in binary, called the machine code. A program written in high-level language is called a source code. We need to convert the source code into machine code and this is accomplished by compilers and interpreters. Hence, a compiler or an interpreter is a program that converts program written in high-level language into machine code understood by the computer.  Interpreter :      1. Translates program one statement at a time.      2. It takes less amount of time to analyze the source code but the overall execution time is slower.      3. No intermediate object code is generated, hence are memory efficient.      4. Continues translating the program until the first error is

Coordinator Layout in Android

Image
CoordinatorLayout is a super-powered FrameLayout.CoordinatorLayout is intended for two primary use cases: As a top-level application decor or chrome layout As a container for a specific interaction with one or more child views By specifying Behaviors for child views of a CoordinatorLayout you can provide many different interactions within a single parent and those views can also interact with one another. View classes can specify a default behavior when used as a child of a CoordinatorLayout using the DefaultBehavior annotation. Behaviors may be used to implement a variety of interactions and additional layout modifications ranging from sliding drawers and panels to swipe-dismissable elements and buttons that stick to other elements as they move and animate. Children of a CoordinatorLayout may have an anchor. This view id must correspond to an arbitrary descendant of the CoordinatorLayout, but it may not be the anchored child itself or a descendant of the anchored child. Thi

Custom Dialog With Call Back in Android

Image
What is Dialog in Android : A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed. Create Custom Layout :   If you want a custom layout in a dialog, create a layout and add it to an AlertDialog by calling setView() on your AlertDialog.Builder object or add it to  Dialod by calling setContentView() on your Dialog object. . Dialog Methods : cancel() : Cancel the dialog. dismiss() : Dismiss the dialog. Removing it from screen . setContentView(int resId) : Set the screen content from layout resource. setCanceledOnTouchOutside(boolean cancel) : Sets whether this dialog is canceled when touched outside the window's bounds.  setCancelable(boolean value) : Sets whether this dialog is cancelable with the BACK key.  requestWindowFeature(int featuredId) : Enable extended window features.