<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Youdorid]]></title><description><![CDATA[Unleash Android excellence with YouDroid! Elevate your development game through inspiring articles on Kotlin, KMM, and cutting-edge mobile innovations.]]></description><link>https://youdroid.dev/</link><image><url>https://youdroid.dev/favicon.png</url><title>Youdorid</title><link>https://youdroid.dev/</link></image><generator>Ghost 5.78</generator><lastBuildDate>Fri, 17 Apr 2026 08:07:33 GMT</lastBuildDate><atom:link href="https://youdroid.dev/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Custom Themes Compose]]></title><description><![CDATA[<p>Today we are going to talk about themes and composition, as usual, design teams always have different themes and custom attributes than MaterialDesign theme so we can always use the material design as the default theme for the app, off course Android has created a custom solution for this problem</p>]]></description><link>https://youdroid.dev/custom-themes-compose/</link><guid isPermaLink="false">65bf1af5d2d3ca0001809cea</guid><dc:creator><![CDATA[Ahmad Najar]]></dc:creator><pubDate>Sun, 04 Feb 2024 06:26:33 GMT</pubDate><media:content url="https://youdroid.dev/content/images/2024/02/Screenshot-2024-02-04-at-8.06.50-AM.png" medium="image"/><content:encoded><![CDATA[<img src="https://youdroid.dev/content/images/2024/02/Screenshot-2024-02-04-at-8.06.50-AM.png" alt="Custom Themes Compose"><p>Today we are going to talk about themes and composition, as usual, design teams always have different themes and custom attributes than MaterialDesign theme so we can always use the material design as the default theme for the app, off course Android has created a custom solution for this problem so you do not have to depend on MaterialTheme,</p><p>Custom Themes Methods</p><p><strong>The simplest approach is to add extension properties.</strong></p><p>An example of this is to add an extension property to the Material Theme,</p><p>I do recommend this way if you do not have a lot of custom properties</p><pre><code class="language-kotlin">private object CustomDesignSystemExtend {
    // [START android_compose_designsystems_custom_extend]
    // Use with MaterialTheme.colors.snackbarAction
    val Colors.snackbarAction: Color
        get() = if (isLight) Red300 else Red700

    // Use with MaterialTheme.typography.textFieldInput
    val Typography.textFieldInput: TextStyle
        get() = TextStyle(/* ... */)

    // Use with MaterialTheme.shapes.card
    val Shapes.card: Shape
        get() = RoundedCornerShape(size = 20.dp)
    // [END android_compose_designsystems_custom_extend]

    val Red300 = Color(0xFFE57373)
    val Red700 = Color(0xFFD32F2F)
}
</code></pre><p>this is an example of adding a custom extension property to MaterialTheme.</p><p>The best way to do it is to create your custom color, typo, shapes, dimensions, etc.. data immutable class, so even if you have multiple themes in the app you use the same object to fill the data with new values and use this theme in your app directly,</p><p>Start by creating your immutable data class that defines your app theme.</p><pre><code class="language-kotlin">   @Immutable
    data class AmazingSpiderColors(
        val tertiary: Color,
        val onTertiary: Color,
        val secondary:Color,
        val onSecondary:Color,
        val primary:Color,
        val onPrimary:Color,
        val bottomActionBar:Color,
        val bottomActionBarText:Color
    )</code></pre><p>Now create these colors by creating new objects, you can create multi-object for each theme</p><pre><code class="language-kotlin"> val amazingSpiderColors = AmazingSpiderColors(
            tertiary = Color(0xFFA8EFF0),
            onTertiary = Color(0xFF002021,
            ...)</code></pre><p>in this example we only create one color object for one theme you create one for Dark one for Light one for Men Dark, and also one for Women as an example,</p><p>to access these colors through its compose theme you need to create its <strong>staticCompositionLocalOf,</strong></p><pre><code class="language-kotlin"> val LocalAmazingSpiderColors = staticCompositionLocalOf {
        AmazingSpiderColors(
            tertiary = Color.Unspecified,
            onTertiary = Color.Unspecified
        )
    }</code></pre><p>What is <strong>staticCompositionLocalOf?</strong></p><p><code>staticCompositionLocalOf</code> provides static, implicitly passed data in Jetpack Compose. Value changes recompose the entire area where it&apos;s used, ideal for infrequent changes and performance optimization. (vs. <code>compositionLocalOf</code> for tracked reads and fine-grained updates.)</p><p>now you can define your theme and provide these colors to it </p><pre><code class="language-kotlin">@Composable
    fun AmazingSpiderTheme(
        content: @Composable () -&gt; Unit
    ) {
        val amazingSpiderColors = AmazingSpiderColors(
            tertiary = Color(0xFFA8EFF0),
            onTertiary = Color(0xFF002021)
        )
        CompositionLocalProvider(LocalAmazingSpiderColors provides amazingSpiderColors) {
            MaterialTheme(
                /* colors = ..., typography = ..., shapes = ... */
                content = content
            )
        }
    }</code></pre><p>Let&apos;s have a full example of this customization with buttons typos and shapes</p><pre><code class="language-kotlin">object FullyCustomDesignSystem {
    // [START android_compose_designsystems_fully_custom]
    @Immutable
    data class CustomColors(
        val content: Color,
        val component: Color,
        val background: List&lt;Color&gt;
    )

    @Immutable
    data class CustomTypography(
        val body: TextStyle,
        val title: TextStyle
    )

    @Immutable
    data class CustomElevation(
        val default: Dp,
        val pressed: Dp
    )

    val LocalCustomColors = staticCompositionLocalOf {
        CustomColors(
            content = Color.Unspecified,
            component = Color.Unspecified,
            background = emptyList()
        )
    }
    val LocalCustomTypography = staticCompositionLocalOf {
        CustomTypography(
            body = TextStyle.Default,
            title = TextStyle.Default
        )
    }
    val LocalCustomElevation = staticCompositionLocalOf {
        CustomElevation(
            default = Dp.Unspecified,
            pressed = Dp.Unspecified
        )
    }

    @Composable
    fun CustomTheme(
        /* ... */
        content: @Composable () -&gt; Unit
    ) {
        val customColors = CustomColors(
            content = Color(0xFFDD0D3C),
            component = Color(0xFFC20029),
            background = listOf(Color.White, Color(0xFFF8BBD0))
        )
        val customTypography = CustomTypography(
            body = TextStyle(fontSize = 16.sp),
            title = TextStyle(fontSize = 32.sp)
        )
        val customElevation = CustomElevation(
            default = 4.dp,
            pressed = 8.dp
        )
        CompositionLocalProvider(
            LocalCustomColors provides customColors,
            LocalCustomTypography provides customTypography,
            LocalCustomElevation provides customElevation,
            content = content
        )
    }

    // Use with eg. CustomTheme.elevation.small
    object CustomTheme {
        val colors: CustomColors
            @Composable
            get() = LocalCustomColors.current
        val typography: CustomTypography
            @Composable
            get() = LocalCustomTypography.current
        val elevation: CustomElevation
            @Composable
            get() = LocalCustomElevation.current
    }
    // [END android_compose_designsystems_fully_custom]

    // [START android_compose_designsystems_fully_custom_usage]
    @Composable
    fun CustomButton(
        onClick: () -&gt; Unit,
        modifier: Modifier = Modifier,
        content: @Composable RowScope.() -&gt; Unit
    ) {
        Button(
            colors = ButtonDefaults.buttonColors(
                containerColor = CustomTheme.colors.component,
                contentColor = CustomTheme.colors.content,
                disabledContainerColor = CustomTheme.colors.content
                    .copy(alpha = 0.12f)
                    .compositeOver(CustomTheme.colors.component),
                disabledContentColor = CustomTheme.colors.content
                    .copy(alpha = ContentAlpha.disabled)
            ),
            shape = ButtonShape,
            elevation = ButtonDefaults.elevatedButtonElevation(
                defaultElevation = CustomTheme.elevation.default,
                pressedElevation = CustomTheme.elevation.pressed
                /* disabledElevation = 0.dp */
            ),
            onClick = onClick,
            modifier = modifier,
            content = {
                ProvideTextStyle(
                    value = CustomTheme.typography.body
                ) {
                    content()
                }
            }
        )
    }

    val ButtonShape = RoundedCornerShape(percent = 50)
    // [END android_compose_designsystems_fully_custom_usage]
}</code></pre><p>Please Look at this Article by android </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://developer.android.com/jetpack/compose/designsystems/custom?ref=youdroid.dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Custom design systems in Compose | Jetpack Compose | Android Developers</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.gstatic.com/devrel-devsite/prod/vc3ca30a8dd09215247ed2418ca05d30c8f8d152f50a65025f3f2761000c1b5fc/android/images/favicon.png" alt="Custom Themes Compose"><span class="kg-bookmark-author">Android Developers</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://developer.android.com/static/images/social/android-developers.png" alt="Custom Themes Compose"></div></a></figure><p>And Github </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/android/snippets/blob/b48562b6cb6dc5e07f80559474a4a414d65a5583/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/CustomDesignSystem.kt?ref=youdroid.dev#L60-L70"><div class="kg-bookmark-content"><div class="kg-bookmark-title">snippets/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/CustomDesignSystem.kt at b48562b6cb6dc5e07f80559474a4a414d65a5583 &#xB7; android/snippets</div><div class="kg-bookmark-description">Main repository for snippets surfaced on developer.android.com. - android/snippets</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg" alt="Custom Themes Compose"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">android</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/b8c58a5fe38cb9a1d3b22c62a5311ab3645ebccd48534c0a671600785feeadcb/android/snippets" alt="Custom Themes Compose"></div></a></figure>]]></content:encoded></item><item><title><![CDATA[SQLite Android]]></title><description><![CDATA[<p>Introduction:</p><p>In the ever-evolving world of mobile app development, choosing the right database for storing and retrieving data is crucial. SQLite has emerged as a popular choice for Android developers due to its lightweight nature and seamless integration capabilities. One powerful library that leverages SQLite in Android is Room. In</p>]]></description><link>https://youdroid.dev/sqlite-android/</link><guid isPermaLink="false">65be05b1d2d3ca0001809c98</guid><dc:creator><![CDATA[Ahmad Najar]]></dc:creator><pubDate>Sat, 03 Feb 2024 09:34:32 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1633412802994-5c058f151b66?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fHNxbHxlbnwwfHx8fDE3MDY5NTIyNTV8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1633412802994-5c058f151b66?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fHNxbHxlbnwwfHx8fDE3MDY5NTIyNTV8MA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="SQLite Android"><p>Introduction:</p><p>In the ever-evolving world of mobile app development, choosing the right database for storing and retrieving data is crucial. SQLite has emerged as a popular choice for Android developers due to its lightweight nature and seamless integration capabilities. One powerful library that leverages SQLite in Android is Room. In this article, we&apos;ll delve into the fundamentals of SQLite, explore its usage in Android, and take a closer look at how Room is built and structured.</p><p>SQLite in Android:</p><p>SQLite is a C library that provides a lightweight, disk-based database. Its self-contained and serverless architecture makes it particularly appealing for mobile applications, especially on Android. Android applications can seamlessly integrate SQLite databases to store and manage structured data.</p><p>Android&apos;s SQLite API provides a set of classes and methods for database operations. Using these APIs, developers can create, update, delete, and query records in the SQLite database. While using the raw SQLite APIs is a valid approach, it can be complex and error-prone. This is where Room, a powerful and robust database library, comes into play.</p><p>Room in Android:</p><p><strong>Room is an abstraction layer over SQLite</strong> that makes database interactions in Android applications more convenient and efficient. It provides compile-time checks, improved syntax, and a set of high-level APIs, making database operations easier to manage.</p><p>Key Components of Room:</p><p><strong>Entity:</strong><br>Room defines the database schema using annotated Java or Kotlin data classes as entities. Each entity represents a table in the SQLite database and the fields of the class map to the columns in the table.</p><pre><code class="language-kotlin">@Entity
data class User(
    @PrimaryKey val userId: Int,
    val username: String,
    val email: String
)
</code></pre>
<p><strong>DAO (Data Access Object):</strong><br>The DAO is responsible for defining the methods that access the database. These methods are annotated with SQL queries and can perform various operations such as insertion, deletion, and querying.</p><pre><code class="language-kotlin">@Dao
interface UserDao {
    @Insert
    suspend fun insert(user: User)

    @Query(&quot;SELECT * FROM User WHERE userId = :id&quot;)
    suspend fun getUserById(id: Int): User?

    // Additional queries and operations
}</code></pre>
<p><strong>Database:</strong><br>The Database is the core component of Room. It is an abstract class that extends <strong><code>RoomDatabase</code></strong> and includes the entities and their corresponding DAOs.</p><pre><code class="language-koltin">@Database(entities = [User::class], version = 1)
abstract class AppDatabase : RoomDatabase() {
    abstract fun userDao(): UserDao
}</code></pre>
<hr><p><strong>Using Room in Android:</strong></p><p><strong>Setup:</strong><br>To use Room in an Android project, add the necessary dependencies to the app&apos;s <code>build.gradle</code> file.</p><pre><code class="language-gradle">implementation &quot;androidx.room:room-runtime:x.x.x&quot;
kapt &quot;androidx.room:room-compiler:x.x.x&quot;</code></pre>
<p><strong>Initialization:</strong><br>Create an instance of the database using the <code>Room.databaseBuilder</code> method.</p><pre><code class="language-kotlin">val db = Room.databaseBuilder(
    applicationContext,
    AppDatabase::class.java, &quot;app-database&quot;
).build()</code></pre>
<p><strong>Executing Database Operations:</strong><br>Use the DAO methods to perform database operations.</p><pre><code class="language-kotlin">val userDao = db.userDao()
val user = User(1, &quot;JohnDoe&quot;, &quot;john.doe@email.com&quot;)
userDao.insert(user)</code></pre>
<p><strong>Conclusion:</strong></p><p>SQLite, coupled with the power and simplicity of Room, offers Android developers a robust solution for database management in their applications. Understanding the architecture and components of Room empowers developers to create efficient and scalable apps while benefiting from the performance advantages of SQLite. As you embark on your Android development journey, consider Room as your go-to database solution for seamless and reliable data storage.</p>]]></content:encoded></item><item><title><![CDATA[Android Development Roadmap]]></title><description><![CDATA[<figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/fodD6UHjLmw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="App Excellence: Android Architecture"></iframe></figure><p>What do you need to start developing Android mobile applications</p><ol><li>Kotlin/Java.</li><li>Object-oriented programming paradigm.</li><li>Functional programming paradigm.</li><li>Software Design Patterns.</li><li>Clean Code and Clean Architecture</li><li>Android Operating Systems</li><li>Android Platform Architecture</li><li>MAD Skills</li></ol><hr><p>Let&apos;s start with basic knowledge and resources about <strong>Kotlin and Java</strong>.</p><p>Java is one</p>]]></description><link>https://youdroid.dev/android-devvelopment-roadmp/</link><guid isPermaLink="false">65bb21d5d2d3ca0001809bc8</guid><dc:creator><![CDATA[Ahmad Najar]]></dc:creator><pubDate>Thu, 01 Feb 2024 05:42:44 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1592111332908-f8f7fe1bb041?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fHJvYWRtYXB8ZW58MHx8fHwxNzA2NzYyNzE3fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/fodD6UHjLmw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="App Excellence: Android Architecture"></iframe></figure><img src="https://images.unsplash.com/photo-1592111332908-f8f7fe1bb041?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fHJvYWRtYXB8ZW58MHx8fHwxNzA2NzYyNzE3fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Android Development Roadmap"><p>What do you need to start developing Android mobile applications</p><ol><li>Kotlin/Java.</li><li>Object-oriented programming paradigm.</li><li>Functional programming paradigm.</li><li>Software Design Patterns.</li><li>Clean Code and Clean Architecture</li><li>Android Operating Systems</li><li>Android Platform Architecture</li><li>MAD Skills</li></ol><hr><p>Let&apos;s start with basic knowledge and resources about <strong>Kotlin and Java</strong>.</p><p>Java is one of the popular programming languages its open source and it was widely used until Oracle Buy the company and made it open for specific versions until then java became a bit difficult to use in enterprise and also the support and development of the language itself become a bit behind, why do we need to talk about Java or learn Java, One of the things you need to know is that Java is still used in many projects and some companies they still have an old legacy code using Java so its good to have a Knowledge of it.</p><p>Here is one of the best Crash courses to learn about Java.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/eIrMbAQSU34?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="Java Tutorial for Beginners"></iframe></figure><hr><p>Now Let&apos;s move to Kotlin after you learn a bit about Java how it works and how to write code with it you need to learn Kotlin to write your first mobile application in Android and also moving forward we can learn to write code in Multiplatform like Web, Desktop, IOS. </p><p>Here is one of the best Crash courses to learn about Kotlin.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/TEXaoSC_8lQ?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="Kotlin Tutorial For Beginners 2023"></iframe></figure><p>After Learning Kotlin I believe you can now write code in Koltin and you have the starter knowledge to start in mobile application Journey.</p><p>Let&apos;s now jump into some of the concepts that make you one of the brilliant developers and help to know and define problems in your application and solve them cleanly and neatly.</p><hr><p>Let&apos;s Learn more about the <strong>Object-oriented programming paradigm</strong></p><p>Here is a great course to learn about this paradigm and enhance more in your Knowledge. </p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/SiBw7os-_zI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="Intro to Object Oriented Programming - Crash Course"></iframe></figure><hr><p>Now the next topic you need to be strong about and will make&apos;s defiant from other developers is <strong>Functional Programming</strong>.</p><p>Kotlin has shared also a very great tutorial watch it to learn more about this paradigm.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/Ed3t4WAe0Co?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="Kotlin &amp; Functional Programming: pick the best, skip the rest by Urs Peter"></iframe></figure><hr><p>Let&apos;s Jump now into <strong>Software Design Patterns</strong>.</p><p>Here is a very good video about design patterns.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/NU_1StN5Tkk?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="Design Patterns in Plain English | Mosh Hamedani"></iframe></figure><p>   Also to learn more about it you can read from one of the best websites.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://refactoring.guru/design-patterns?ref=youdroid.dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Design Patterns</div><div class="kg-bookmark-description">Design Patterns are typical solutions to commonly occurring problems in software design. They are blueprints that you can customize to solve a particular design problem in your code.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://refactoring.guru/favicon.png" alt="Android Development Roadmap"></div></div><div class="kg-bookmark-thumbnail"><img src="https://refactoring.guru/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868" alt="Android Development Roadmap"></div></a></figure><hr><p>Now you need to learn about writing <strong>Clean Code and Clean Arcticiture</strong> </p><blockquote>this topic is a bit advanced you can learn it while you are on the journey </blockquote><p>In this topic, you always need to learn from the best <strong>Uncle Bob</strong></p><p>Here is a very good playlist for Uncle Bob explaining clean code and clean architecture</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/videoseries?list=PLmmYSbUCWJ4x1GO839azG_BBw8rkh-zOj" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></figure><hr><p>Now after you learn about software engineering and you become a solid software engineer let&apos;s start with <strong>Android Mobile Development</strong>.</p><p>Let&apos;s begin with Android Operating Systems </p><p>Keep this Digram in your mind this explains how the operating system works and how it&apos;s structured.</p><figure class="kg-card kg-image-card"><img src="https://youdroid.dev/content/images/2024/02/OQES8vD.jpg" class="kg-image" alt="Android Development Roadmap" loading="lazy" width="800" height="522" srcset="https://youdroid.dev/content/images/size/w600/2024/02/OQES8vD.jpg 600w, https://youdroid.dev/content/images/2024/02/OQES8vD.jpg 800w" sizes="(min-width: 720px) 720px"></figure><hr><p>Let&apos;s also start with the <strong>Android Components</strong>.</p><p><strong>1. Core Components:</strong></p><ul><li><strong>Activities:</strong> Represent the UI and handle user interactions within an app.</li><li><strong>Content Providers:</strong> Manage and share application data with other apps.</li><li><strong>Intents:</strong> Enable communication between different components of an Android app or between different apps.</li><li><strong>Services:</strong> Run in the background to perform long-running operations or handle tasks without a user interface.</li></ul><p><strong>2. AndroidManifest:</strong></p><ul><li><strong>AndroidManifest.xml:</strong> A crucial configuration file that provides essential information about an Android app, such as its components, permissions, and hardware requirements.</li></ul><p><strong>3. App Structure:</strong></p><ul><li><strong>Broadcast Receivers:</strong> Respond to system-wide broadcast announcements or communicate between apps.</li><li><strong>Fragments:</strong> Modular UI components that represent portions of an activity.</li><li><strong>Views:</strong> UI elements like buttons, text fields, and images.</li><li><strong>XML File:</strong> Used for layout and resource definitions in Android applications.</li><li><strong>Compose:</strong> Jetpack Compose is a modern Android UI toolkit that simplifies and accelerates UI development on Android. It allows developers to build UIs using a declarative syntax in Kotlin, making UI development more concise and less error-prone compared to the traditional XML-based approach.</li></ul><p><strong>4. Development Concepts:</strong></p><ul><li><strong>About Android:</strong> General information about the Android operating system and its development environment.</li><li><strong>Libraries:</strong> External code packages that provide pre-built functionality for developers to use.</li><li><strong>Linux Kernel:</strong> The underlying operating system kernel upon which Android is based.</li><li><strong>Resources:</strong> External assets such as images, strings, and layouts used in an Android app.</li><li><strong>Widgets:</strong> UI components like buttons, sliders, etc., that users can interact with.</li></ul><p><strong>5. Build and Distribution:</strong></p><ul><li><strong>APK Build:</strong> The process of compiling and packaging an Android application into an APK (Android Package) file.</li><li><strong>Application Framework:</strong> A set of APIs and tools provided by the Android system to help developers build apps more efficiently.</li></ul><p><strong>6. Application Components:</strong></p><ul><li><strong>Applications:</strong> The end-user software that runs on Android devices.</li></ul><p>These components and concepts collectively form the foundation for developing Android applications. Understanding how they interact and utilizing them effectively is crucial for building robust and efficient Android apps.</p><hr><p>Let&apos;s Learn more also about <strong>MAD Skills</strong>.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://developer.android.com/series/mad-skills?ref=youdroid.dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Modern Android Development Skills | Modern Android development | Android Developers</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.gstatic.com/devrel-devsite/prod/v2df3c70ff8eb01e8c0bb049c3da894e4221ea678ae827e9fb45267d1a61dc2be/android/images/favicon.png" alt="Android Development Roadmap"><span class="kg-bookmark-author">Android Developers</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://developer.android.com/static/images/social/android-developers.png" alt="Android Development Roadmap"></div></a></figure><p></p><p>Here are also some Books you need to keep in your Library </p><ol><li><a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?crid=2MEKUACFTJUQX&amp;keywords=Clean+code&amp;qid=1706765834&amp;sprefix=clean+co%2Caps%2C312&amp;sr=8-1&amp;ref=youdroid.dev" rel="noreferrer">Clean Code: A Handbook of Agile Software Craftsmanship</a></li><li><a href="https://www.amazon.com/Clean-Architecture-Craftsmans-Software-Structure/dp/0134494164/ref=sr_1_1?crid=IMCNCLRSZ9S7&amp;keywords=clean+architecture&amp;qid=1706765896&amp;sprefix=Clean+Arc%2Caps%2C274&amp;sr=8-1&amp;ref=youdroid.dev" rel="noreferrer">Clean Architecture: A Craftsman&apos;s Guide to Software Structure and Design (Robert C. Martin Series)</a></li><li><a href="https://www.amazon.com/Head-First-Design-Patterns-Object-Oriented/dp/149207800X/ref=sr_1_3?crid=2M4UM7UKQWFD7&amp;keywords=Design+Patterns&amp;qid=1706765957&amp;sprefix=design+patterns%2Caps%2C274&amp;sr=8-3&amp;ref=youdroid.dev" rel="noreferrer">Head First Design Patterns: Building Extensible and Maintainable Object-Oriented Software 2nd Edition.</a></li><li><a href="https://www.amazon.com/Refactoring-Improving-Existing-Addison-Wesley-Signature/dp/0134757599/ref=sr_1_1?crid=1CO16ZVMRDW9P&amp;keywords=refactoring&amp;qid=1706765994&amp;sprefix=Refactoring%2Caps%2C269&amp;sr=8-1&amp;ref=youdroid.dev" rel="noreferrer">Refactoring: Improving the Design of Existing Code (2nd Edition) (Addison-Wesley Signature Series (Fowler))</a></li><li><a href="https://www.amazon.com/Grokking-Algorithms-illustrated-programmers-curious/dp/1617292230/ref=sr_1_9?crid=E7H5RP7C5O6X&amp;keywords=koltin+data+structure+and+algorithms&amp;qid=1706766100&amp;sprefix=koltin+data+stracture+and+alogrthimsis+%2Caps%2C256&amp;sr=8-9&amp;ref=youdroid.dev" rel="noreferrer">Grokking Algorithms: An Illustrated Guide for Programmers and Other Curious People</a>.</li></ol>]]></content:encoded></item><item><title><![CDATA[Refactor your code like pro.]]></title><description><![CDATA[Refactoring is a day to day job and is not a special occasion task.]]></description><link>https://youdroid.dev/refactor-your-code-like-pro/</link><guid isPermaLink="false">65ba1858d2d3ca0001809b26</guid><category><![CDATA[Android]]></category><dc:creator><![CDATA[Ahmad Najar]]></dc:creator><pubDate>Tue, 06 Jul 2021 06:33:37 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1564865878688-9a244444042a?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDN8fGNvZGUlMjB8ZW58MHx8fHwxNzA2NzYyNjA2fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<blockquote>Refactoring is day to day job is not a special occasion task.</blockquote><img src="https://images.unsplash.com/photo-1564865878688-9a244444042a?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDN8fGNvZGUlMjB8ZW58MHx8fHwxNzA2NzYyNjA2fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Refactor your code like pro."><p>Best book to read for refactoring is<br>1. Refactoring by (martin fowler)</p><figure class="kg-card kg-image-card"><img src="https://youdroid.dev/content/images/2024/01/1-gfaapudracoexhphkrk1iq.png" class="kg-image" alt="Refactor your code like pro." loading="lazy" width="500" height="319"></figure><p>2.Working effectively with legacy code by (Michael C. Feathers)</p><hr><p>Always keep this three questions in your mind when you refactor your code.</p><ul><li>Why do we need a refactor?</li><li>When do we need to refactor?</li><li>And how to refactor?</li></ul><p><strong>The first question answer is</strong></p><ol><li>Technology limitations and support.</li><li>Cost of the existing code maintenance.</li><li>Spaghetti code not will written and not easy to test will lead to time and money.</li><li>Some times technology is like fashion and you should be fashionable but not the most correct reason.</li></ol><p><strong>The second question answer is</strong></p><p>First you need your approach is it a strategic decision or is it an enterprise culture. Still you need to think about refactor small parts while you are working</p><p><strong>The third question answer is</strong></p>]]></content:encoded></item><item><title><![CDATA[Kotlin Flow with MVI]]></title><description><![CDATA[Before we start we want to have a small intro about the presentation architecture we are using these days to handle and work with our…]]></description><link>https://youdroid.dev/kotlin-flow-with-mvi/</link><guid isPermaLink="false">65ba1858d2d3ca0001809b25</guid><dc:creator><![CDATA[Ahmad Najar]]></dc:creator><pubDate>Mon, 29 Mar 2021 11:29:10 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1503437313881-503a91226402?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDE3fHxjb2RlJTIwfGVufDB8fHx8MTcwNjc2MjYwNnww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1503437313881-503a91226402?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDE3fHxjb2RlJTIwfGVufDB8fHx8MTcwNjc2MjYwNnww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Kotlin Flow with MVI"><p>Before we start we want to have a small intro about the presentation architecture we are using these days to handle and work with our fragments and activities in the past 3 years we start working with the popular MVP and it was very useful to work with android and separating the logic from the UI the thing is it&#x2019;s not reactive and we want to have something more reactive to work with plus in android, we really have a massive issue when we rotate our phones by losing the current screen state so thankfully Google decided to have a very useful pattern called MVVM where we have a view model and the view model will have an observer and we listen to the changes happening on this observer the thing is I see in many projects that we have a single view model with more than 5 to 6 observers in it why is that because it&#x2019;s easy to create observers and post data to them and change the UI with it but when it comes to testing the UI some times things happened form any of the observers we are observing and we can&#x2019;t trace where thes changes comes from so we have to trace our observers one by one and see the code implemented and check where exactly the issue is and what exactly happend in every observer we have that&#x2019;s alot and when we are going to write testing for our porject we find it hard to test also for me at least &#x1F614; becuse i need to opserver on the error or the loading or the result this a big thing to do now when I start looking around I find a very handy pattern called MVI so what is MVI its Model-View-Intent so the model is our bussiness logic and the view as we know the ui part and the intent where the user send as interaction with the application if you think about it you will se it easy to understand the user pass an intent -&gt; then the intent will me manged by the model and pssing a view state to the view to set the view state and so on the cycle will keep repate unitl the user finish and soo on I don&#x2019;t want to talk alot about the architectures patterns and more writnig let&#x2019;s jumo into the code</p><p>I saw an example about implementing MVI with android and I find very handy examples to implement it one of the easy and nice examples is</p>
<!--kg-card-begin: html-->
<figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/orbit-mvi/orbit-mvi?ref=youdroid.dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">orbit-mvi/orbit-mvi</div><div class="kg-bookmark-description">Join us at the Kotlinlang slack! If you do not yet have an account with the Kotlinlang slack workspace, sign up here&#x2026;</div><div class="kg-bookmark-metadata"></div></div><div class="kg-bookmark-thumbnail"><img src="https://youdroid.dev/content/images/2024/01/0-_lfte-2te5shhquv.png" alt="Kotlin Flow with MVI"></div></a></figure>
<!--kg-card-end: html-->
<p><a href="https://github.com/ww-tech/roxie?ref=youdroid.dev" rel="nofollow noopener">https://github.com/ww-tech/roxie</a></p><p>and also others on GitHub thanks god we have very good developers to write code who also like to share their knowledge with us.</p><p>so if you look into the Roxie you will find that they change the naming to make it more understandable and easy to deal with rather than intent they call it Action and the process they call it to change so you will have action and change then the change will be reduced to ViewState you can have a look to the GitHub of the library it&#x2019;s very nice to work with but it&#x2019;s in RxJava that&apos;s a very good library but it&#x2019;s really hard to learn so we decide to move with Flow it&#x2019;s simple and easy to learn and we can write code with the same high quality we have in RxJave and without having any issues handling the concurrency or learning all the operators in the RxJava.</p><p><strong>Let&#x2019;s begin</strong></p><ol><li>First to we need to have an example here the example is we need to login or register the user to the system so what we need is that we have a repository that will take care of that so ether will pass success or throw an exception.</li></ol><ul><li>Our Repository will look like thisinterface AuthRepository {<br>    @Throws(IllegalArgumentException::class)<br>    suspend fun login(email: String, password: String): Flow&lt;Boolean&gt;<br><br>    @Throws(IllegalArgumentException::class)<br>    suspend fun register(email: String, password: String, displayName: String): Flow&lt;Boolean&gt;<br>}</li></ul><p>2. then we need a ViewModel to deal with the actions and access the repo or the use case then return the ViewState before that let&apos;s have a look at what actions we need here.sealed class Actions {<br>    data class LoginRequest(val email: String, val password: String) : Actions()<br>    data class RegisterRequest(val email: String, val password: String, val displayName: String) : Actions()<br>    object Init : Actions()<br>}</p><p>we will have an action for login and action for signup and if we need to have to init action for the first init state when we load the screen for the first time like load some data or do something before user start.</p><p>after that, we need to have a look for the next class where the action will be mapped to Change let&#x2019;s have a look at the changes we have in the project.sealed class Change {<br>    object LoadingChange : Change()<br>    data class LoggedChange(val isLogged: Boolean) : Change()<br>    data class RegisteredChange(val isRegistered: Boolean) : Change()<br>    data class ErrorChange(val throwable: Throwable?) : Change()<br>}</p><p>thous are the most changes we will need to handle our actions and map our view state.</p><p>Now the ViewState we listen for the changes of this view state by rendering it in the UI, let&#x2019;s have a look at our view statedata class State(<br>    val isIdle: Boolean = true,<br>    val isLoading: Boolean = false,<br>    val isLogged: Boolean = false,<br>    val isRegistered: Boolean = false,<br>    val throwable: Throwable? = null<br>)</p><p>after we build our classes lets have a look how the actions will be handled and converted to view state</p><p>a user dispatched and action to our view model by this functionfun dispatch(action: Actions) {<br>    <em>viewModelScope</em>.<em>launch </em><strong>{ </strong>actions.emit(action) <strong>}</strong><br>}</p><p>by calling from the UI with this flow alsoeditEmail.<em>textChanges</em>()<br>    .<em>combine</em>(editPassword.<em>textChanges</em>(), ::LoginRequest)<br>    .<em>flatMapConcat </em><strong>{ </strong>pair <strong>-&gt; </strong>buttonLogin.<em>clicks</em>().<em>map </em><strong>{ </strong>pair <strong>} }<br>    </strong>.<em>onEach </em><strong>{ </strong>viewModel.dispatch(<strong>it</strong>) <strong>}<br>    </strong>.collect <strong>{ }</strong></p><p>Now if you have a look you will see that the code still looks clean and functional and looks exactly as you are writing RxJava code but with ease of Flow.</p><p>Now the ViewModel after receiving the action will listen to the actions state flowprivate val actions = <em>MutableStateFlow</em>&lt;Actions&gt;(Actions.Init)</p><p>Then we will be merging our all actions together and wait until we emit an action here you will see that actions are filtered by instance and if it matches it will transform to another flow then it will map it to LoggedChange with the resultprivate val loginChanges = actions<br>    .<em>filterIsInstance</em>&lt;LoginRequest&gt;()<br>    .<em>transform </em><strong>{<br>        </strong>emit(Change.LoadingChange)<br>        emitAll(authRepository.login(<strong>it</strong>.email, <strong>it</strong>.password)<br>            .<em>map </em><strong>{ </strong>result <strong>-&gt; </strong>Change.LoggedChange(result) <strong>}</strong>)<br>    <strong>}<br>    </strong>.<em>catch </em><strong>{ </strong>emit(Change.ErrorChange(<strong>it</strong>)) <strong>}<br>    </strong>.<em>flowOn</em>(io)</p><p>same for the signup but with a different change</p><p>then after we are having the actions build and connected to the repository we can now merge our actions and reduce them to ViewState</p><p>you will have a scan operator that will take initiate state and will have a reducer function holding the current change and old view-state, then we will copy the view state and change it to the new view-state</p><ul><li>State examplefun state(): LiveData&lt;State&gt; = <em>merge</em>(loginChanges, registerChanges)<br>    .<em>scan</em>(initState, reducer)<br>    .<em>asLiveData</em>(main)</li><li>Reducer exampleprivate val reducer: suspend (State, Change) -&gt; State = <strong>{ </strong>state, change <strong>-&gt;<br>    </strong>when (change) {<br>        is Change.LoadingChange -&gt; state.copy(isIdle = false, isLoading = true)<br>        is Change.ErrorChange -&gt; state.copy(<br>            throwable = change.throwable,<br>            isLoading = false<br>        )<br>        is Change.LoggedChange -&gt; state.copy(<br>            isLoading = false,<br>            isLogged = change.isLogged<br>        )<br><br>        is Change.RegisteredChange -&gt; state.copy(<br>            isLoading = false,<br>            isRegistered = change.isRegistered<br>        )<br>    }<br><strong>}</strong></li></ul><p>and that&apos;s it you have now MVI Pattern with the flow now you just need to observe on the state from the UI the good thing is that you have only one way in one way out actions then state.</p><p>Example of the renderviewModel.state().<em>observe</em>(this@MainActivity, ::render)</p><p>the render function will have a view stateprivate fun render(state: State) {<br>    progressBar.<em>let </em><strong>{<br>        </strong>if (state.isLoading) {<br>            <strong>it</strong>.show()<br>        } else {<br>            <strong>it</strong>.hide()<br>        }<br>    <strong>}<br>    </strong>editEmail.<em>isEnabled </em>= !state.isLoading<br>    editPassword.<em>isEnabled </em>= !state.isLoading<br><br><br>    state.isLogged.<em>takeIf </em><strong>{ it }</strong>?.<em>let </em><strong>{<br>        </strong>Toast.makeText(this, &quot;User Is Logged&quot;, Toast.<em>LENGTH_SHORT</em>).show()<br>    <strong>}</strong><br>}</p><p>and here we are, enjoy working with MVI now the testing part will be also covered in the next article.</p><p>GitHub</p>
<!--kg-card-begin: html-->
<figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/a-najar/mvi-flow?ref=youdroid.dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">a-najar/mvi-flow</div><div class="kg-bookmark-description">Contribute to a-najar/mvi-flow development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"></div></div><div class="kg-bookmark-thumbnail"><img src="https://youdroid.dev/content/images/2024/01/0-ihl0om5akdicbowb.jpg" alt="Kotlin Flow with MVI"></div></a></figure>
<!--kg-card-end: html-->
]]></content:encoded></item><item><title><![CDATA[MVI For android]]></title><description><![CDATA[I start working with it because I need to implement it in my code so when I start doing a feature which have many deferent actions in it…]]></description><link>https://youdroid.dev/mvi-for-android/</link><guid isPermaLink="false">65ba1858d2d3ca0001809b27</guid><dc:creator><![CDATA[Ahmad Najar]]></dc:creator><pubDate>Sat, 27 Jun 2020 17:55:04 GMT</pubDate><media:content url="https://youdroid.dev/content/images/2024/01/1-16cq9yo7-e7zbjjwqsqr8a.png" medium="image"/><content:encoded><![CDATA[<img src="https://youdroid.dev/content/images/2024/01/1-16cq9yo7-e7zbjjwqsqr8a.png" alt="MVI For android"><p>I start working with it because I need to implement it in my code so when I start doing a feature which have many deferent actions in it the screen start becoming bigger,I feel the mvvm start having spaghetti code, I end up having many live data in it, so I have to observer on many of them,</p><p>also I don&#x2019;t want to change my all code base to mvi, so I start searching to see if I can use deferent presentation architecture in the project so</p><p>I find out that <strong>Yes</strong> you can do it and this is a good way to do it .</p><p>I&#x2019;m still using mvvm and I use the presentation architecture depends on the screen and the UseCases in it.</p><p>So if the screen need to have to have deferent UseCases I do it with MVI</p><p>And the screen which have less use cases like one or two and the cases is easy to be tested and it just need to request and show something small I do it with MVVM.</p><p>Now I want to share with you the things I watched and read to learn it.</p><p>With MVI all of the use cases are covered and you observe in one place and render your UI from this place and it&#x2019;s also good to separate the ui from the logic, it&#x2019;s easy to test, the code is clean and readable and maintainable.</p><p>How It work in simple Way</p><ol><li>Intent is converted to actions</li><li>Actions is converted to model</li><li>Model is responsible for data this part is also separated and you can test alone and you can mock</li><li>The Model is converted to Result</li><li>The Result is converted to State</li></ol><p>If you just want to make it more simple you push and Intent to the model and the model will be responsible to push for you a ViewState thats it this pattern is taken from Web from frameworks Like Redux and Cycle JS</p><p>One of the best articles to read</p><p><a href="https://www.linkedin.com/pulse/mvi-pattern-android-4-steps-ahmed-adel-ismail/?ref=youdroid.dev" rel="noopener">https://www.linkedin.com/pulse/mvi-pattern-android-4-steps-ahmed-adel-ismail/</a></p><p>Also you can start with this talk.</p><p><a href="https://www.youtube.com/watch?v=PXBXcHQeDLE&amp;t=1525s&amp;ref=youdroid.dev" rel="noopener">https://www.youtube.com/watch?v=PXBXcHQeDLE&amp;t=1525s</a></p><p><a href="https://github.com/oldergod/android-architecture?ref=youdroid.dev" rel="noopener">https://github.com/oldergod/android-architecture</a></p><p>In this talk he is using RxJava but also there is some easier and faster implementation.</p><p>You can also use A framework Like roxie</p><p><a href="https://github.com/ww-tech/roxie?ref=youdroid.dev" rel="noopener">https://github.com/ww-tech/roxie</a></p><p><a href="https://proandroiddev.com/unidirectional-data-flow-with-roxie-bec546c18598?ref=youdroid.dev" rel="noopener">https://proandroiddev.com/unidirectional-data-flow-with-roxie-bec546c18598</a></p><p>#android #MVI #GOOGLE #development #UI #testing</p>]]></content:encoded></item></channel></rss>