Posts

How to use object in Kotlin

Image
 In Kotlin, object is used when you need a single instance of a class or when defining an anonymous object . Here are the main use cases: 1. Singletons (Object Declarations) Use object when you need a single instance of a class throughout your application. ⚡ Use case: Managing a database connection, network client, or app-wide configuration. 2. Companion Objects Use companion object inside a class to define static-like behavior. ⚡ Use case: Factory methods, constants, or utility functions within a class. 3. Anonymous Objects (Object Expressions) Use object when you need a one-time implementation of an interface or class. ⚡ Use case: Implementing listeners or callbacks without creating a full class. 4. Object Inheritance (Using object with a Superclass) If a singleton needs to extend another class or implement an interface: ⚡ Use case: Creating a global logging instance. Summary Singleton (object) Global database manager, configuration, logging Static-like behavior (companion ...

Keyboard Shortcuts

Ctrl + Alt + l     =      Reformat Alignment Code Shift +F6     =     Refactor      Shift + F12     =     Open Terminal    

The Clean Architecture

Image
  data: It contains the business logic

Android Compose

Accessibility Scanner

  Accessibility Scanner Test your app's accessibility Get Started with Accessibility

Dimens Resources

  App resources overview Resource types overview Add app resources More resource types

Floating Action Button

  Add a Floating Action Button FloatingActionButton Floating Action Buttons Buttons: floating action button

Material Design

  Material Design for Android ">Material Design for Android Bring your app to life with Material Design Design for Android material.io Reference documentation Getting started with Material Components

Style Resource

  Style resource Typography

Themes and fonts

  Downloadable Fonts Fonts in XML Styles and Themes Design app themes with Theme Editor

TextView XML Attributes

TextView XML Attributes

How to store data

Data Storage Save data in a local database using Room  

Retrofit Query

  Retrofit Query

Parcel and Parcelables

Image
 In Android, parceling is a way of sharing objects between different processes by flattering an object into a String of data called parcel.  A complex object can be stored into the parcel and then recreated from the parcel by implementing the parcelable interface and then become parcelable objects Each value in the object is written in sequence to the parcel The object is recreated by reading data from the parcel in the same order it was written to populate data in a new object.  Using a arcel to share an object between processes, is functionally similar to using XML or JSON to share data between web services and clients. A bundle is a parcelable object that contains a key value store of parcelable objects . We use bundles as the argument property in fragments, primarly because of the way that Android lifecycle works. Activities will be destroyed with a SaveInstanceState if the app is killed when running in the background.  All of the information in the SaveInst...

Kotlin Coroutines Adapter

  Kotlin Coroutines Adapter

Moshi Library

  Moshi - A Modern JSON Library for Kotlin and Java Retrofit MoshiConverterFactory

Permissions

  Reference documentation Permissions overview Request App Permissions App permissions best practices Define a Custom App Permission

Connect to the Network

  Connect to the Network

Retrofit

  Retrofit - Type-safe HTTP client for Android Retrofit Github

RecyclerView

  RecyclerView RecyclerView.Adapter Create a List with RecyclerView RecyclerView.ViewHolder Customize Your RecyclerView Customize Your GridLayout