Programming Language for Android

Kotlin Overview

  • Kotlin is a JVM language.
  • It needs Java Virtual Machine to execute its bytecode.
  • Compatible with Java (and Android APIs).
  • Modern language features.
  • It has support to provide NullPointerException.
  • It is an Object Oriented Programming language.
  • Functional Programming Language. We can pass a function as a parameter to another function. Or a function can return another function.
  • Concise, Less boilerplate.

Declaring variables

Life of Android Activity

Android activity
Android activity

Android Interview for small businesses

android interview
android interview
  1. Introduction
  2. Technical
  3. HR round

1. Introduction

Organizing your Android App

android architecture
android architecture
  • No clear separation of concern
  • Difficult to unit test
  • Tight coupling
  • Unmanageable, congested and pain in the eyes

Programming Language for Android



Step 1 — Starting a new activity for result

MainActivity.javaint REQUEST_CODE = 1;
Intent intent = new Intent(MainActivity.this, ChildActivity.class);
intent.putExtra("number1", number1);
intent.putExtra("number2", number2);
startActivityForResult(intent, REQUEST_CODE);

Sending data from fragment to fragment/activity or activity to fragment

Activity Fragment Communication
Activity Fragment Communication

Case 1 - Steps to send a message from Fragment to Activity

  1. Create an interface (in the Fragment).
  2. Create an instance of this interface in the fragment.
  3. Implement this interface in the activity.
  4. In the fragment, initialize the interface instance with the activity’s reference using the context received in the onAttach(Context context) method.
  5. Call the interface method in your fragment which will trigger the callback to the activity’s method implementation.

So, let’s implement this step by step

  1. Create fragment class


Code (Java/Kotlin)

Android Apps are amazing

Android core architecture is divided into four main layers :

Adil Khan

Mobile Application Enthusiast, an Android developer and a keen observer of life

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store