<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Benidict Dulce on Medium]]></title>
        <description><![CDATA[Stories by Benidict Dulce on Medium]]></description>
        <link>https://medium.com/@benidict-dulce?source=rss-d8e9853f0fd0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*emJZnEaOxtP-R1yNkJhMPA.jpeg</url>
            <title>Stories by Benidict Dulce on Medium</title>
            <link>https://medium.com/@benidict-dulce?source=rss-d8e9853f0fd0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 10:17:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@benidict-dulce/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Typewriter Animation Effect in Jetpack Compose]]></title>
            <link>https://benidict-dulce.medium.com/typewriter-animation-effect-in-jetpack-compose-ea731f0051c0?source=rss-d8e9853f0fd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea731f0051c0</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[typewriter-effect]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Benidict Dulce]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 15:19:11 GMT</pubDate>
            <atom:updated>2025-02-10T15:19:11.876Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*OPjG7LoBb1307GirXjhtsA.gif" /><figcaption>by: dev community</figcaption></figure><p>In this article, I will show you how to create a Typewriter Animation Effect in Jetpack Compose. You will need a basic understanding of Jetpack Compose to follow along.</p><p>In your Android project, create a new Composable function and name it TextTypeWriterEffectView. This function is responsible for the typewriter animation effect. You will need to pass the following parameters into the function:</p><ul><li><strong>text</strong>: The string that you want to display in your Text component.</li><li><strong>delay</strong>: Controls the speed of the typewriter animation.</li><li><strong>style</strong>: The TextStyle applied to the text.</li><li><strong>modifier</strong>: A Modifier used to customize the appearance of the Text component.</li><li><strong>content</strong>: A higher-order function that can return another composable when the animation completes.</li></ul><p>First, we need to create a mutable variable that will hold the text displayed on the screen. We use remember to make the state persistent across recompositions, and mutableStateOf to store the value:</p><pre>var textToDisplay by remember { mutableStateOf(&quot;&quot;) }</pre><p>Next, use LaunchedEffect to ensure the animation only runs when the text changes. Inside the LaunchedEffect block, loop through each character in the text string and append it to textToDisplay one character at a time. Additionally, LaunchedEffect is used to run a delay suspend function within the composable, which is added between each character to simulate the typewriter effect:</p><pre>LaunchedEffect(key1 = text) {<br>    for (i in text.toCharArray()) {<br>        textToDisplay += i.toString()<br>        delay(delay)<br>    }<br>}</pre><p>Next, display the textToDisplay in a Text component. This component will update as each character is appended:</p><pre>Text(<br>    modifier = modifier?: Modifier,<br>    text = textToDisplay,<br>    style = style?: TextStyle()<br>)</pre><p>Finally, we will apply the content callback to trigger an action once the effect is complete.</p><pre>content?.let { returnContent -&gt;<br>    if (textToDisplay == text)<br>        returnContent()<br>}</pre><p>Once you’ve completed this, your code should look like the one below.</p><pre>@Composable<br>fun TextTypeWriterEffectView(<br>    text: String,<br>    delay: Long = 160L,<br>    style: TextStyle ?= null,<br>    modifier: Modifier?= null,<br>    content: @Composable (() -&gt; Unit) ?= null<br>){<br>    var textToDisplay by remember { mutableStateOf(&quot;&quot;) }<br>    LaunchedEffect(key1 = text) {<br>        for (i in text.toCharArray()) {<br>            textToDisplay += i.toString()<br>            delay(delay)<br>        }<br>    }<br><br>    Text(<br>        modifier = modifier?: Modifier,<br>        text = textToDisplay,<br>        style = style?: TextStyle()<br>    )<br><br>    content?.let { returnContent -&gt;<br>        if (textToDisplay == text)<br>            returnContent()<br>    }<br>}</pre><p>That’s it! I hope you found this article helpful and that you now have a clear understanding. 😄</p><p>You can check the full source code below.</p><p><a href="https://github.com/benidict1995/typewriter-effect">GitHub - benidict1995/typewriter-effect</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea731f0051c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Type-Safe Navigation Jetpack Compose]]></title>
            <link>https://benidict-dulce.medium.com/type-safe-navigation-jetpack-compose-b8a44716b548?source=rss-d8e9853f0fd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8a44716b548</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[navigation-component]]></category>
            <category><![CDATA[kotlin-dsl]]></category>
            <category><![CDATA[navigation]]></category>
            <dc:creator><![CDATA[Benidict Dulce]]></dc:creator>
            <pubDate>Wed, 19 Jun 2024 13:08:17 GMT</pubDate>
            <atom:updated>2024-06-19T14:04:35.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BsLxtgISgHczRiUhc0Ef9g.png" /></figure><p><strong>Kotlin DSL</strong> is one way to build the navigation graph since 2018. This API allows you to declaratively compose your graph in your Kotlin code, rather than inside an XML resource.</p><p>When we transition to Jetpack Compose, We use <strong>Navigation Compose API</strong> to navigate between composables “<em>while taking advantage of the Navigation component’s infrastructure and features”</em>. It’s sounds great but the new navigation is string-based navigation in general and the screen route is looks like an url. Each parameter must be <strong>String</strong> and <strong>encoded</strong>.</p><p>Everything is a String!</p><p>For you to observe, I will show you how the compose navigation looks like before the version <strong>2.8.0</strong> .</p><p><strong>Navigation Component has 5 concepts:</strong></p><ul><li><strong>Host</strong> — the UI element in your layout that displays the current ‘destination’</li><li><strong>Graph</strong> — the data structure that defines all of the possible destinations in your app</li><li><strong>Controller</strong> — the central coordinator that manages navigating between destinations and saving the back stack of destinations</li><li><strong>Destination</strong> — A node in the navigation graph. When the user navigates to this node, the host displays its content.</li><li><strong>Route</strong> — Uniquely identifies a destination and any data required by it.</li></ul><p>First defined the routes in enum class, you can also use the routes directly to the graph as string.</p><pre>enum class Screen {<br>    TEAM,<br>    GAMES<br>}</pre><p>Second create enum for your graph, you can also use the graph directly to the graph as string.</p><pre>enum class Graph {<br>    HOME_GRAPH<br>}</pre><p>Now we will create the graph.</p><pre>NavHost(<br>    navController = navController,<br>    route = Graph.HOME_GRAPH.name,<br>    startDestination = Screen.TEAM.name<br>) {<br>    composable(route = Screen.TEAM.name) {<br>        TeamsScreen {<br>            navController.navigate(&quot;${Screen.TEAM_DETAILS.name}/${it.toJson()}&quot;)<br>        }<br>    }<br>    composable(route = Screen.GAMES.name) {<br>        GamesScreen { id -&gt;<br>            navController.navigate(&quot;${Screen.GAME_DETAILS.name}/$id&quot;)<br>        }<br>    }<br>}</pre><p>As you can see the route of navigation component is similar to the web app url. This is what the route looks like in regular string <em>“team/id” . </em>you need<em> </em>include the placeholder for the unique ID of the data.</p><h3><strong>Finally Type safety is now available in Navigation Compose</strong> <strong>and</strong> <strong>Navigation Kotlin DSL!</strong></h3><p>They are available as of Navigation 2.8.0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*xg1WAGfxz4uDL09lMkmGHg.gif" /></figure><p>These APIs are equivalent to what <a href="https://developer.android.com/guide/navigation/navigation-pass-data#Safe-args"><strong>Safe Args</strong></a> provides to navigation graphs built-in navigation XML resource files.</p><h3>Define routes</h3><p>To use type-safe routes in Compose, you first need to define serializable classes or objects that represent your routes.</p><ul><li><strong>Object</strong>: Use an object for routes without arguments.</li><li><strong>Class</strong>: Use a class or data class for routes with arguments.</li><li><strong>KClass&lt;T&gt;</strong>: Use if you don&#39;t need to pass arguments, such as a class without parameters, or a class where all parameters have default values</li></ul><p>For example: Exercise::class</p><p>In either case, the object or class must be serializable.</p><pre>@Serializable<br>object SplashRoute // Define a splash route that doesn&#39;t take any arguments<br><br>@Serializable<br>object HomeRoute // Define a home route that doesn&#39;t take any arguments<br><br>@Serializable<br>data class Exercise (<br>    val name: String,<br>    val type: String,<br>    val muscle: String,<br>    val equipment: String,<br>    val difficulty: String,<br>    val instructions: String<br>)</pre><h3>Build your graph</h3><p>Next is create your navigation graph.</p><pre>@Composable<br>fun SetupNavGraph(navController: NavHostController) {<br>    NavHost(<br>        navController = navController,<br>        startDestination = SplashRoute,<br>    ) {<br>        composable&lt;SplashRoute&gt; {<br>            SplashScreen(navController = navController)<br>        }<br>        composable&lt;HomeRoute&gt; {<br>            HomeScreen(navController = navController)<br>        }<br>        composable&lt;Exercise&gt; { backStackEntry -&gt;<br>            val exercise: Exercise = backStackEntry.toRoute()<br>            ExerciseDetailsScreen(navController, exercise)<br>        }<br>    }<br>}</pre><p>Observe the following in this example:</p><ul><li>composable() takes a type parameter. That is, composable&lt;Exercise&gt;.</li><li>Defining the destination type is a more robust approach than passing a <a href="https://developer.android.com/reference/kotlin/androidx/navigation/NavGraphBuilder#(androidx.navigation.NavGraphBuilder).composable(kotlin.String,kotlin.collections.List,kotlin.collections.List,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)">route</a> <a href="https://developer.android.com/reference/kotlin/androidx/navigation/NavGraphBuilder#(androidx.navigation.NavGraphBuilder).composable(kotlin.String,kotlin.collections.List,kotlin.collections.List,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)">string</a> as in composable(&quot;exercise&quot;).</li><li>The route class defines the type of each navigation argument, as in val name: String, so there&#39;s no need for <a href="https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument">NavArgument</a>.</li><li>For the profile route, the toRoute() extension method recreates the Exercise object from the <a href="https://developer.android.com/reference/androidx/navigation/NavBackStackEntry">NavBackStackEntry</a> and its arguments.</li></ul><p>And last navigate to your type safe route by using the <a href="https://developer.android.com/reference/kotlin/androidx/navigation/NavGraphBuilder#(androidx.navigation.NavGraphBuilder).composable(kotlin.collections.Map,kotlin.collections.List,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)">navigate()</a> .</p><pre>navController.navigate(<br>                Exercise(<br>                    name = exercises.value[index].name,<br>                    type = exercises.value[index].type,<br>                    muscle = exercises.value[index].muscle,<br>                    equipment = exercises.value[index].equipment,<br>                    difficulty = exercises.value[index].difficulty,<br>                    instructions = exercises.value[index].instructions,<br>                ),<br>            )</pre><p>Here’s the final usage!</p><pre>val exercises = viewModel.exerciseState.collectAsState()<br>LazyColumn(modifier = Modifier.padding(16.dp, 0.dp, 16.dp, 0.dp)) {<br>    items(exercises.value.size) { index -&gt;<br>        HorizontalDivider(color = Color.Transparent, modifier = Modifier.height(10.dp))<br>        ExerciseCard(exercise = exercises.value[index]) {<br>            navController.navigate(<br>                Exercise(<br>                    name = exercises.value[index].name,<br>                    type = exercises.value[index].type,<br>                    muscle = exercises.value[index].muscle,<br>                    equipment = exercises.value[index].equipment,<br>                    difficulty = exercises.value[index].difficulty,<br>                    instructions = exercises.value[index].instructions,<br>                ),<br>            )<br>        }<br>    }<br>}</pre><p>You can check the full source code below.</p><p><strong>nba-stats </strong>— It uses the string-based route</p><p><strong>training-camp</strong> — It uses the serialized object and classes route</p><ul><li><a href="https://github.com/benidict1995/nba-stats/tree/develop">GitHub - benidict1995/nba-stats at develop</a></li><li><a href="https://github.com/benidict1995/jetpack-compose-playground/tree/main/training-camp">jetpack-compose-playground/training-camp at main · benidict1995/jetpack-compose-playground</a></li></ul><p><strong>I HOPE THIS WILL HELP YOU GUYS, HAPPY CODING!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8a44716b548" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hilt Dagger Android Tutorial]]></title>
            <link>https://benidict-dulce.medium.com/hilt-dagger-android-tutorial-e0813c188a33?source=rss-d8e9853f0fd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0813c188a33</guid>
            <category><![CDATA[android-dependencies]]></category>
            <category><![CDATA[dagger-2]]></category>
            <category><![CDATA[dagger-hilt]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <dc:creator><![CDATA[Benidict Dulce]]></dc:creator>
            <pubDate>Mon, 30 Nov 2020 17:38:52 GMT</pubDate>
            <atom:updated>2021-07-31T10:39:28.108Z</atom:updated>
            <content:encoded><![CDATA[<p>New Dependency Injection library for android</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DlzI4f0lDPp4UwdyV5JFrA.jpeg" /><figcaption>Photo by <a href="https://medium.com/u/d7750b47e778">Yudiz.com</a></figcaption></figure><p><strong>Dependency Injection(DI) — </strong>is a technique in which an object receives other objects that it depends on. DI can be implemented in any programming language. The general concept behind dependency injection is called inversion of control.</p><p>In android development, we integrate a lot of dependencies most of the time, e.g. objects etc. We use the Dependency Injection framework to manage those dependencies.</p><p>Over these past few years, a lot of dependency injection framework has been developed. One of the popular for Android is Dagger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*UnxLd1ya_e_zgjub-PKZlg.gif" /><figcaption>Photo by <a href="https://medium.com/u/6ef28bb6f48c">Tenor</a></figcaption></figure><p><strong>Dagger — </strong>is arguably the most used dependency injection for android. Many android projects use it to simplify building and providing dependencies across the application but to set up requires a large amount of boilerplate code.</p><p>Currently, a new dependency injection library for android called <strong>Hilt Dagger </strong>was release as a part of the jetpack libraries. It reduces the boilerplate of doing manual dependency injection in your project. It provides a standard way to use DI in your application by providing containers for every android class in your project and managing their life cycles automatically. Currently hilt is on alpha stage release.</p><p><strong>The goals of hilt:</strong></p><ul><li>To simplify dagger-related infrastructure for android apps.</li><li>To create a standard set of components and scopes to ease setup, readability/understanding, and code sharing between apps.</li><li>To provided an easy way to provision different bindings to various build types(e.g. testing, debug or release).</li></ul><p><strong>Hilt current supports the following Android classes:</strong></p><ul><li>Application</li><li>Activity</li><li>Fragment</li><li>View</li><li>Service</li><li>Broadcast Receiver</li></ul><p><strong>Generated components for android classes</strong></p><p>For each Android class that can perform field injection, there’s an associated Hilt component that you can refer to in the <strong>@InstallIn</strong> annotation. Each Hilt component is responsible for injecting its bindings into the corresponding Android class.</p><p><strong>Hilt provides the following components:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*4jlzb8AK5JdW0pH-4z2p2A.png" /><figcaption>Photo by <a href="https://medium.com/u/d8e9853f0fd0">Benidict Dulce</a></figcaption></figure><p>Since we already know what is Hilt, its purpose and its components. Let’s jump to the sample.</p><p>I’ll show you how to set up the Hilt dagger below.</p><p>First, we need to set up Hilt dependencies in our build gradle. Add these dependencies in your app build.gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88aa8b30f135c3d1cc64093f3a09e431/href">https://medium.com/media/88aa8b30f135c3d1cc64093f3a09e431/href</a></iframe><p>Then add this plugin at the top of your build.gradle file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0efda9143b1d8c0675dace0cd46b56bb/href">https://medium.com/media/0efda9143b1d8c0675dace0cd46b56bb/href</a></iframe><p>Next, we will add the following classpath in the project build.gradle file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66afe4d9e359985b0cadb09c41088709/href">https://medium.com/media/66afe4d9e359985b0cadb09c41088709/href</a></iframe><p>Lastly, sync your gradle.</p><p>Once your gradle is successfully synced, let’s start the Hilt set up in your application. We will use clean architecture and MVVM architecture for this example.</p><p>First, create an Application class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8d8922f2621ccfc33393d2adb755e77/href">https://medium.com/media/e8d8922f2621ccfc33393d2adb755e77/href</a></iframe><p>And annotate the @HiltAndroidApp in the application class, so your application class will look like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/842eebc85d7adf881bee79fb41e060a0/href">https://medium.com/media/842eebc85d7adf881bee79fb41e060a0/href</a></iframe><p>This is mandatory since it generates all the component classes which we need while using Hilt dagger.</p><p>Second, create a repository class that is also called data gateway and repository interface and create a sample function that returns a string.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4eb7138cd2b96714ff7146619117113f/href">https://medium.com/media/4eb7138cd2b96714ff7146619117113f/href</a></iframe><p>Then implement this interface class into our data gateway class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64e32bfaac13efc331445c53f3753374/href">https://medium.com/media/64e32bfaac13efc331445c53f3753374/href</a></iframe><p>Once the gateway class was created, add a package module then create a GatewayModule class. Below will be the instance of your TestDataGateway class here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b70cc5b77ad8801fdee955a4965e982/href">https://medium.com/media/5b70cc5b77ad8801fdee955a4965e982/href</a></iframe><p>Our GatewayModule class will look like in the above sample. Since we used ApplicationComponent, the scope of our TestDataGateway has the lifetime of the application. But if you want to limit the scope of our TestDataGateway to Activity, you can use ActivityComponent instead.</p><p>Third, create an interactor class which we sometimes call a use case class. The purpose of our use case class is to invoke the data from our data gateway class and consume into our viewmodel class. You can do your data manipulation in usecase or if you want, you can call the data gateway class directly into our viewmodel. In my case, I prefer to have a use case.</p><p>You can check out in this <a href="https://proandroiddev.com/why-you-need-use-cases-interactors-142e8a6fe576"><strong>link</strong></a><strong>.</strong> Why we need usecase/interactor.</p><p>Now, let’s create a usecase class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b47a4d4acd91b055c71b3332509c9b27/href">https://medium.com/media/b47a4d4acd91b055c71b3332509c9b27/href</a></iframe><p>Since we need to call the data gateway in our usecase class, we need to inject our gateway interface into the constructor of our LoadTestUseCase.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc3225364a9e076cba01df69fc87ce96/href">https://medium.com/media/dc3225364a9e076cba01df69fc87ce96/href</a></iframe><p><strong>Hooray!</strong> We have now completed our set up for our data layer. We will proceed next to the view of our application.</p><p>In our Activity or Fragment class, annotate the <strong>@AndroidEntryPoint</strong>. It generates an individual Hilt component for each Android class in your project. These components receive dependencies from their respective parent classes as described in Component <a href="https://developer.android.com/training/dependency-injection/hilt-android#component-hierarchy"><strong>hierarchy</strong></a><strong>.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0cb5a02c29ac23ddabd91120ab259fc3/href">https://medium.com/media/0cb5a02c29ac23ddabd91120ab259fc3/href</a></iframe><p>Annotate entry point then inject our view model in our activity. But first, we need to create a viewmodel class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ca1b1eba28a786541e6c840604d4f3e/href">https://medium.com/media/5ca1b1eba28a786541e6c840604d4f3e/href</a></iframe><p>Before we inject our viewmodel class into our activity/fragment, we will need to provide ViewModel Factory as a discussed <a href="https://developer.android.com/reference/android/arch/lifecycle/ViewModelProvider.Factory"><strong>here</strong></a>. There’s so many things that is needed to be set up, but with Hilt dagger everything is simplified.</p><p>Say Hi to <strong>@ViewModelInject</strong></p><p>Check out the link below for the initial set up.</p><p><a href="https://medium.com/mobile-app-development-publication/dagger-hilt-even-shorter-and-easier-881255ea54dd">Dagger Hilt: Even Shorter and Easier!</a></p><p>To use <strong>@ViewModelInject</strong>, we need to add two additional dependencies in our app build.gradle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e70c8aab6af03c1970f4f9fa3f55e33a/href">https://medium.com/media/e70c8aab6af03c1970f4f9fa3f55e33a/href</a></iframe><p>After adding those dependencies, in your viewmodel, just add <strong>@ViewModelInject</strong> to the constructor.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c8d6e06a1672ebfac885a52d384b5bf/href">https://medium.com/media/8c8d6e06a1672ebfac885a52d384b5bf/href</a></iframe><p>And finally, we will inject our view model into our activity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe636eb86c09c97bc846b6c7f9d4de3b/href">https://medium.com/media/fe636eb86c09c97bc846b6c7f9d4de3b/href</a></iframe><p>As you can see, we don’t need to create a ViewModel Factory to inject our view model into activity.</p><blockquote><strong>Yehey! No ViewModel Factory needed!</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*J3nj1A5P2hFm_CvBAVoG0A.gif" /></figure><p>You no longer need the ViewModel Factory, All you need to do is to use viewModels() directly into our view.</p><p>You can check the full source code below. It also has an api integration sample.</p><p><a href="https://github.com/benidict1995/hilt-dagger-android">benidict1995/hilt-dagger-android</a></p><p><strong>I HOPE THIS WILL HELP YOU GUYS, HAPPY CODING!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0813c188a33" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>