Introduce Android

Papon Ahasan
13 min readJan 21, 2023

1. IDE

IDE means Integrated Development Environment. An IDE is a software application that provides the writing and editing of source code.

The most popular IDEs used for Android development :

  • Android Studio
  • IntelliJ IDEA
  • Eclipse
  • NetBeans
  • Komodo

Google’s recommended option — is Android Studio. Android Studio is the official IDE for Android development built on JetBrains IntelliJ IDEA software.

2. Language

There are only two native Android development languages to choose from — Kotlin and Java.

Java has been Android’s favorite for a decade until it was replaced with Kotlin in 2019. Kotlin has taken the official android development language. Developed by JetBrains in 2011.

Here are the main characteristics of Kotlin:

  • Concise language
  • Clean
  • Lightweight
  • Combines features of both object-oriented and functional programming
  • Used for backend, iOS, Android, and web apps.

3. Anatomy of an app

Automotive engineers can’t make a car without knowing which parts it consists of.

Activities: The best way to understand an activity is to look at an app screen. One app screen represents one activity and vice versa.

Fragments: While activities make up a single UI screen, fragments make up parts of an activity. They’re more efficient in representing UI and also when you need to reuse an interface on different screens such as tablets’ way of representing UI.

Intents: Intents as links between activities. They enable you to go from one activity to another or from one screen to another.

We have 3 different types of intents:

  • Explicit intent — requests the launch of an activity by referencing its class name. Android Explicit intent specifies the component to be invoked from activity. In other words, we can call another activity in android by explicit intent. We can also pass the information from one activity to another using explicit intent.
  • Implicit intent -requests launch of activity without needing the class name. Such as opening a webpage or sending an email, without specifying a specific component.
  • Broadcast intent — sends intents to all apps that are broadcast receivers

Services:

We have 2 types of services :

  • Background services: (not notify the user) A background service performs an operation that isn’t directly noticed by the user. For example, if an app used a service to compact its storage, that would usually be a background service.
  • Foreground services: (notify the user) Foreground services can be interacted with users, for example, the notification the user gets as they’re listening to music, or downloading a file that they can use to control the app without an interface.

Application manifest:

There’s an important file that lists all the major app parts. It’s called the AndroidManifest.xml. It lists components such as:

  • Activities
  • Services
  • Broadcast receivers

Resources: Resource files contain resources such as strings, fonts, colors, and images.

4. UI(User Interface)

The User interface is the face of your app. It’s also a means of communication between the app and the user. Android provides a lot of pre-built components which help in creating apps. For example, you can build layouts using XML or Jetpack Compose.

Layouts: The main components of UI are layouts. They define the structure of your app, such as an activity or a fragment.

Widgets: Widgets/views are the basic building blocks of the UI. A view is a rectangle on the screen that shows some type of content.

The most commonly used view classes are:

  • TextView
  • Button
  • ImageView
  • EditText
  • CheckBox
  • Spinner
  • RecyclerView
  • When displaying a larger amount of data like lists the RecyclerView

5. Paradigm of asynchronous programming

It takes time to fetch a larger scale of data from an API or a local database. To reduce that time, asynchronous programming provides efficient validation of the data state.

একটি API বা একটি local ডাটাবেস থেকে larger স্কেল ডেটা আনতে সময় লাগে৷ সেই সময় 
কমাতে, অ্যাসিঙ্ক্রোনাস প্রোগ্রামিং ডেটা স্টেটের কার্যকরী বৈধতা প্রদান করে।

For example, while fetching data from API we want to display a progress indicator on the screen to inform the user that an action is in progress. After the action is finished there are two possible outcomes: either the data was successfully loaded and displayed on the screen or an error message was displayed to inform the user to try again.

Some of the most common options when it comes to asynchronous programming on Android are:

  • Android service
  • Callbacks
  • Reactive programming (like RxJava or RxKotlin)
  • Kotlin coroutines

6. Android Jetpack

Android Jetpack was introduced back in 2018., and it brought great changes related to building Android apps.

It is a suite of software components and libraries that helps developers to:

  • Follow best practices
  • Reduce boilerplate code
  • Write code consistent with all android versions and devices

Jetpack some of the more important components:

  1. LiveData: LiveData is a Lifecycle aware component and an observable data holder class. An observable object notifies other objects when something in its data changes and that allows the user interface to always match the latest data.

Live data works well in resolving issues such as:

  • Removes the leaks caused by the interfaces/callbacks that send results to the UI thread.
  • De-couples tight integration between data, mediator, and the UI layers.

2. Navigation: Very few Android apps today consist of just a single screen. Most apps contain multiple screens. The implementation of navigation within an app was mostly a coding process with no easy way to view and organize potentially complex navigation paths. The navigation component makes navigation look easy.

3. Dagger (Hilt): A dependency injection library for Android. It is used for managing dependencies between different components of your app, and it helps to make your code more modular and testable.

4. Hilt: Hilt is built on top of the popular DI library Dagger so benefits from the compile-time correctness, runtime performance, and scalability are well preserved.

7. Store data

There are several options to pick from when it comes to storing your data. First, you need to specify which type and the amount of data you want to store.

  • Just store one String or a Boolean value you can use shared preferences: DataStore.
  • Store a larger amount of complex data, use SQLite and Room
  • Cloud Storage: Firebase, Aws, Azure

Room: A persistence library for Android. It is used for storing and retrieving data from a local SQLite database, and it supports a wide range of data types.

Firebase: A mobile development platform for Android and iOS. It offers many services for mobile app development including analytics, databases, notifications, and more.

8. Connect the app internet

Network requests are used to retrieve or modify API data from a server. This is a very common task in mobile app development.

Most popular libraries that will make your network handling :

Retrofit: Retrofit is a type-safe REST client for Android, which aims to make it easier to consume RESTful web services. Retrofit makes it easy to consume JSON or XML data which are parsed into Plain Old Java Objects (POJOs). It is built on top of OkHttp.

Gson: Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. It works the same way with Kotlin data classes.

Moshi: Moshi is a modern JSON library for Android, Java, and Kotlin. It makes it easy to parse JSON into Java and Kotlin classes.

9. Application architecture

Until the introduction of Android Jetpack Google didn’t recommend a specific approach to building Android applications.

Google now advocates single-activity apps where different screens are loaded as content within the same activity. Also, the recommendation separates different areas of responsibility within the app into separate modules.

Android application architectures are:

  • MVVM
  • MVP
  • MVC
  • VIPER

MVVM: Most popular one is MVVM. Model — View — ViewModel (MVVM) is the industry-recognized software architecture pattern that overcomes all drawbacks of MVP and MVC design patterns. MVVM suggests separating the data presentation logic (UI) from the core business logic part of the application.

  • MODEL — holds application data. They are usually structures of simple data. Model and ViewModel work together to get and save the data.
  • VIEW — displays visual elements on the screen and notifies the ViewModel about user interactions.
  • ViewModel — transforms model information into values that can be displayed on the view.

10. Test Code

Testing is a fundamental part of the software development life cycle (SDLC).

By running tests against your app consistently, you can verify your app’s correctness, functional behavior, and usability before you release it.

টেস্টিং সফটওয়্যার ডেভেলপমেন্ট লাইফ সাইকেলের (SDLC) একটি মৌলিক অংশ।
আপনার অ্যাপের বিরুদ্ধে ধারাবাহিকভাবে পরীক্ষা চালিয়ে, আপনি এটি প্রকাশ করার আগে 
আপনার অ্যাপের সঠিকতা, কার্যকরী আচরণ এবং ব্যবহারযোগ্যতা যাচাই করতে পারেন।

Testing advantages:

  • Saves money
  • Improves security
  • Improves product quality

Types of tests on Android

  • Functional testing
  • Performance testing
  • Accessibility testing
  • Compatibility testing

Tests also vary depending on size, or degree of isolation:

  • Unit tests
  • End-to-end testing
  • Medium tests

11. Library

Picassa: Picassa is a type-safe REST client for Android, which aims to make it easier to consume RESTful web services.

Glide: An image loading and caching library for Android. It is used for loading and displaying images in your app, and it supports a wide range of image formats.

Dagger: A dependency injection library for Android. It is used for managing dependencies between different components of your app, and it helps to make your code more modular and testable.

RXJava: A reactive programming library for Android. It is used for handling asynchronous tasks, such as network requests, and it helps to make your code more readable and maintainable.

Butter Knife: A view binding library for Android. It is used for binding views in your layout to variables in your code, and it helps to make your code more readable and maintainable.

Timber: A logging library for Android. It is used for logging messages in your app, and it helps to make it easier to debug and troubleshoot issues.

Gson: A JSON parsing library for Android. It is used for parsing JSON data and converting it into Java objects, and it helps to make it easier to work with JSON data in your app.

LeakCanary: A memory leak detection library for Android. It is used for identifying and fixing memory leaks in your app, and it helps to improve the performance and stability of your app.

  1. Database: Room is a popular library for working with SQLite databases in Android. It provides an abstraction layer over SQLite and makes it easier to work with data in your app.
  2. Images: Glide and Picasso are popular libraries for loading and displaying images in Android. They both offer similar functionality and are easy to use.
  3. Networking: Retrofit is a popular library for handling network requests and responses in Android. It provides a type-safe and easy-to-use API for working with web services.
  4. Design: Material Components for Android is a popular library for implementing Material Design in Android apps. It provides a wide range of components that follow Material Design guidelines.
  5. Coding: Kotlin Coroutines is a popular library for handling asynchronous tasks and concurrency in Android. It provides a more efficient and readable alternative to traditional threading.
  6. Analytics: Firebase Analytics is a popular library for tracking user engagement and events in your app. It provides detailed insights about your app’s usage and performance.
  7. In-App Purchasing: Billing Library is a popular library that allows you to sell in-app products and subscriptions.
  8. Push Notifications: Firebase Cloud Messaging (FCM) is a popular library for sending and receiving push notifications in Android.
  9. Maps and Location: Google Maps SDK is a popular library for displaying maps and working with location data in Android.
  10. Dependency Injection: Dagger is a popular library for managing dependencies between different components of your app. It helps to make your code more modular and testable.

Q: I wish to become an android developer. which pre-requirements me need if I am android

If you want to become an android developer, here are some prerequisites that you should have or learn:

  1. Programming knowledge: A strong understanding of programming concepts such as variables, loops, control structures, data structures, and algorithms is essential. Java is the primary language used for Android development, so you should have a good understanding of it.
  2. Object-Oriented Programming (OOP): OOP concepts such as inheritance, polymorphism, encapsulation, and abstraction are key to understanding how to create and organize code in Android.
  3. XML and layout: You should have a good understanding of XML, which is used to define the layout and user interface of an Android app. You should also be familiar with the different layout managers and views that are available in Android, such as LinearLayout, RelativeLayout, and RecyclerView.
  4. Android SDK and Android Studio: You should be familiar with the Android SDK and Android Studio, which are the primary tools used for Android development. The SDK includes the libraries and APIs that are needed to develop Android apps, and Android Studio is the primary IDE (Integrated Development Environment) used to write, debug, and deploy Android apps.
  5. Debugging and testing: You should be familiar with debugging techniques and tools in Android, such as Logcat and the Android Studio debugger. You should also be familiar with testing frameworks such as JUnit and Espresso, which are used to test the functionality of Android apps.
  6. Understanding of Android architecture: Understanding of Android architecture, such as MVP, MVVM, and MVI can help you to design and build robust and maintainable apps.
  7. JavaScript: In case you want to use web-based technologies to build apps for Android, you should be familiar with JavaScript.
  8. Understanding of version control systems: Familiarity with version control systems such as Git is essential to track changes and collaboration on code with other developers.

By mastering these prerequisites, you will have the foundation you need to start developing your own Android apps and continue to build upon that foundation as you gain more experience.

Q: need data structure and algorithm

Yes, a good understanding of data structures and algorithms is important for an Android developer, as it helps with designing and implementing efficient solutions for different types of problems. Here are some specific ways in which data structures and algorithms can be useful for Android development:

  1. Efficient data storage and retrieval: Understanding data structures such as arrays, linked lists, hash maps, and trees can help with designing efficient solutions for storing and retrieving data in an Android app.
  2. Performance optimization: Understanding algorithms such as sorting, searching, and graph traversal can help with optimizing the performance of an Android app. For example, using a sorting algorithm can help to sort a large list of items in a short amount of time.
  3. Algorithm Design: Understanding algorithm design techniques such as divide and conquer, and greedy and dynamic programming can help you to solve complex problems in an efficient and optimal way.
  4. Designing efficient solutions: Understanding data structures and algorithms can help to design solutions that are more efficient in terms of time and space complexity.
  5. Problem-Solving: Understanding of data structures and algorithms can help you to solve problems in a more efficient and elegant way.

It’s important to note that, it’s not necessary to master all data structures and algorithms, but having a good understanding of the most common ones and being able to recognize when to use them can be very beneficial.

Q: Is any database knowledge needed? and which oop topic knowledge need?

Yes, having knowledge of databases is important for an Android developer as it helps with storing, retrieving, and manipulating data in an app. Here are some specific ways in which database knowledge can be useful for Android development:

  1. Storing data: Understanding database concepts such as tables, rows, columns, and SQL can help with designing efficient solutions for storing data in an Android app.
  2. Retrieving data: Understanding SQL queries and how to use them to retrieve data from a database can help with designing efficient solutions for retrieving data in an Android app.
  3. Manipulating data: Understanding database concepts such as insert, update and delete and how to use them can help with designing efficient solutions for manipulating data in an Android app.
  4. Relational databases: Understanding concepts like One-to-One, One-to-Many, and Many-to-Many relationships can help you design an efficient database schema for your app.
  5. ORM: Understanding ORM (Object-relational mapping) concepts and frameworks such as Room and Realm can help you to interact with databases in a more efficient and elegant way.

Regarding Object-oriented programming, here are some OOP concepts that are useful for Android development:

  1. Inheritance: Understanding how to create classes that inherit properties and methods from parent classes can help with designing reusable and maintainable code.
  2. Polymorphism: Understanding how to create classes that can be used in multiple ways and how to use interfaces and abstract classes can help with designing flexible and extensible code.
  3. Encapsulation: Understanding how to use private, protected and public modifiers to encapsulate data and methods can help with designing secure and maintainable code.
  4. Design Patterns: Understanding design patterns such as Singleton, Factory, and Observer can

Q: networking need

Yes, understanding networking concepts is important for an Android developer, as it helps with communicating with remote servers and services in order to retrieve or send data. Here are some specific ways in which networking knowledge can be useful for Android development:

  1. Retrieving data from a web service: Understanding concepts such as HTTP, REST, and JSON can help with designing efficient solutions for retrieving data from a web service in an Android app.
  2. Sending data to a web service: Understanding concepts such as HTTP, REST, and JSON can help with designing efficient solutions for sending data to a web service in an Android app.
  3. Authentication and Authorization: Understanding concepts such as OAuth, JWT, and session management can help with designing secure solutions for authentication and authorization in an Android app.
  4. WebSocket: Understanding WebSocket protocol and how to use it can help with creating real-time and bidirectional communication between the app and the server.
  5. AsyncTask and Retrofit: Understanding how to use AsyncTask and Retrofit to handle network requests asynchronously can help with designing efficient and responsive solutions for network communication in an Android app.
  6. Error handling: Understanding how to handle network errors such as timeouts and connection failures can help with designing robust and reliable solutions for network communication in an Android app.

Networking is an important aspect of mobile development, having a good understanding of networking concepts can help you to create efficient, secure, and responsive apps.

--

--