Kodeco Forums

Android Architecture Components: Getting Started

Take advantage of the new Android Architecture Components in your Kotlin Android app, including Lifecycle, LiveData, and ViewModel.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/164-android-architecture-components-getting-started

Great Artikle,

Im wondering how can i access the injected App?

I would like to access the App (context) in the NetworkingModule.

In the App we inject the App … component.inject(this)

How can i access that?

Thanks in advance

Hello,
Thanks for kind words! :]

In case you need to access the app context from another module, you can use it from the App singleton, by calling App.instance.

In case you want to provide it through Dagger, you can create an AppModule which receives the context as constructor parameters (as a val), and then provide it using said value.

Then simply include the AppModule in the networking module. :]

Hope this helps!

BreweryDB is closed for developers:

We are not currently accepting applications for public API keys. For commercial licensing opportunities, please contact us at feedback@steadyserv.com.

Hey @namyxc,

Unfortunately, yes, it seems that BreweryDB has closed it’s API for public usage. :[

At the time of writing and publishing of the tutorial, the API was valid, so it seems like a recent change.

Thank you for your feedback, and I’d like to invite you to stay put, as we’ll most definitely update the tutorial to use a different API. With beers, of course. :]

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!