android-mvp

LifecycleRegistry not getting initialized, in the BaseActivity for MVP architecture

扶醉桌前 提交于 2020-11-29 11:00:08
问题 I have the few Base classes defined for my Activity and Fragment, Presenter, and ViewHolder, and ViewModel, and an interface and Presenter being defined, All other activities inheriting these base classes, and In my BaseActivity class and BaseFragmentClass, i am creating lifecycleRegistry object and initializing it, but when the App is launched it crashes with error getLifecycle() returned null in ComponentActivity's constructor. Please make sure you are lazily constructing your Lifecycle in

cannot be provided without an @Provides-annotated method Dagger/MissingBinding

巧了我就是萌 提交于 2020-02-06 08:01:55
问题 Unable to inject presenter to Activity BookDashboard -> Activity class BookDashboard : AppCompatActivity(),BookDashboardContract.MvpView{ @Inject lateinit var presenter: BookDashboardContract.Presenter override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) presenter.fetchedBooks() // if I pass no parameter to BookPresenter than UninitializedPropertyAccessException: lateinit property presenter has not been initialized } override fun displayBooks() { Toast

@subcomponent.factory method is missing parameters for required modules or subcomponents

百般思念 提交于 2020-02-06 07:23:20
问题 I am injecting Presenter to BookDashboard (Activity) and BookDashboardPresenter class require an MvpView interface in it's constructor . When i run AppComponent @Component( modules = [ AndroidInjectionModule::class, ActivityBuilder::class ] ) @Singleton interface AppComponent : AndroidInjector<App> { @Component.Builder interface Builder { fun addContext(@BindsInstance context: Context): Builder fun addBookEngine(@BindsInstance bookEngineModule: BookEngineModule) :Builder fun build():

Not able to understand dagger dependency injection concepts - Dagger 2 on android [closed]

人走茶凉 提交于 2019-12-25 21:01:09
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I am trying to understand dagger2 and implement in my app. I have read a lot about its benefits. Unless and until I understand it completely, I cannot get the benefits of it in my app. I have understood @Module and @Inject. The one that confuses me is @Component. I have few

What role an Android Service should play in the MVP pattern?

╄→гoц情女王★ 提交于 2019-12-20 12:32:10
问题 I am developing an Android app that does Human Activity Recognition. It basically works like that - Service constantly reads the accelerator data and stores the recognized activity (i.e. Walking, running) in a database. The user can see all of the recognized activities in an ListView in activity (accesses the database). Every User table in the database has a pa_goal (physical activity goal) field which the Service reads from the database and does some checks. The user, of course, can change

Implementing MVP on a single activity with two (or multiple) fragments

北战南征 提交于 2019-12-10 14:46:38
问题 I'm developing a small application that shows a list, and when an item is clicked it opens a secondary screen with the item details. I want to implement MVP as my architecture for this app, and i have been struggling figuring out how to do that when I have a single activity with 2 fragments . Some questions came up as when an item from the list is clicked, a callback is sent to the first presenter, but at this point, who is in charge of opening the second fragment? do the presenters 'talk' to

Dagger 2 Scopes, where to place Presenters?

偶尔善良 提交于 2019-12-08 04:05:22
问题 what would it be the best practice about placing Presenters in a Scope? Could we have Presenters on @Singleton or @AppScope without any problem? Should they be placed in an @ActivityScope in order to destroy them each time the activity is destroyed? 回答1: what would it be the best practice about placing Presenters in a Scope? Usually a presenter should be in some scope. Not placing it in any scope will lead to problems, as every time you request a presenter it would create a new one. Which

Dagger 2 Scopes, where to place Presenters?

放肆的年华 提交于 2019-12-07 00:08:37
what would it be the best practice about placing Presenters in a Scope? Could we have Presenters on @Singleton or @AppScope without any problem? Should they be placed in an @ActivityScope in order to destroy them each time the activity is destroyed? what would it be the best practice about placing Presenters in a Scope? Usually a presenter should be in some scope. Not placing it in any scope will lead to problems, as every time you request a presenter it would create a new one. Which scope you choose mostly depends on your programming style, but the most common would probably be @PerActivity ,

Using clean MVP on android with RxJava: How can you keep the presenter free of any android knowledge while still observing on the UI thread?

孤街醉人 提交于 2019-12-06 04:13:26
问题 In an effort to implement 'clean' architecture on android with the mvp pattern it is advised to treat the android framework as a plugin and not leak any android aware dependencies into the presenter layer. Using rxjava, if I have a presenter that is designed to 'push' data to the view layer I may want to have logic like this: public interface SearchPresenter { interface ViewLayer { void updateResults(List<SearchResult> searchResults) } void bind(ViewLayer viewLayer); void unbind(); } public

Using clean MVP on android with RxJava: How can you keep the presenter free of any android knowledge while still observing on the UI thread?

六月ゝ 毕业季﹏ 提交于 2019-12-04 09:46:12
In an effort to implement 'clean' architecture on android with the mvp pattern it is advised to treat the android framework as a plugin and not leak any android aware dependencies into the presenter layer. Using rxjava, if I have a presenter that is designed to 'push' data to the view layer I may want to have logic like this: public interface SearchPresenter { interface ViewLayer { void updateResults(List<SearchResult> searchResults) } void bind(ViewLayer viewLayer); void unbind(); } public class SearchPresenterImpl implements SearchPresenter { ViewLayer viewLayer; CompositeDisposable