ở đây bạn phải sữa "NetModule.class" thành AppModule.class vì mình đang viết component với AppModule --> thiếu AppModule.class:
-đây là AppModule class:
@Module
public class AppModule {
Application mApplication;
public AppModule(Application application) {
mApplication = application;
}
@Provides
@Singleton
Application providesApplication() {
return mApplication;
}
}
Cuoi cung trong MyApp extends Application ban sữa khởi tạo netComponent lai thành thế nay them vao ".appModule(new AppModule(this))":
public class MyApp extends Application {
private NetComponent mNetComponent;
@Override
public void onCreate() {
super.onCreate();
mNetComponent = DaggerNetComponent.builder().appModule(new AppModule(this))
// list of modules that are part of this component need to be created here too
.netModule(new NetModule())
.build();
}
public NetComponent getNetComponent() {
return mNetComponent;
}
}
-> vay la xong
Noi them: ngoai ra trong MyActivity.class ban co the tim phu thuoc bang cach nay thi khong can AppComponent.class:
THẢO LUẬN
awesome!
thanks bạn!
thanks bạn!
Nguồn: https://medium.com/the-renaissance-developer/idiomatic-ruby-1b5fa1445098
Mình sẽ tiếp tục nghiên cứu ^^
(like)
Tks anh nhiều ạ, hóa ra SCSS với SASS là một à
awesome
Quản lý source code có thể kể thêm SourceTree (https://www.sourcetreeapp.com/), miễn phí, giao diện thân thiện, dùng khá tốt.
Mình đã fix được bạn tham khảo xem sao:
ở đây bạn phải sữa "NetModule.class" thành AppModule.class vì mình đang viết component với AppModule --> thiếu AppModule.class:
-đây là AppModule class:
-> vay la xong
Noi them: ngoai ra trong MyActivity.class ban co the tim phu thuoc bang cach nay thi khong can AppComponent.class:
thu nhat them method "void inject(MyActivity activity);" vao NetComponent.class nhu sau:
cuoi cung trong MyActivity.class
còn nhiều cái thú vị lắm. tiếp tục viết bài về Apollo nhé bạn.
tks tác giả
tks tác giả
Đây là bài mình dịch thôi bạn, mình có ghi nguồn ở phần tham khảo đấy. Cái thiếu là mình không ghi rõ đây là bài dịch. Cảm ơn bạn đã góp ý
bài này ôm từ Howkteam qua thì phải? thấy logo Kteam!
Hehe đang cần cái này. Cảm ơn bạn.
bài viết rất hay, thanks bro (Y)
tks tác giả ạ
thanks tác giả với những chia sẻ trên