roboguice

Android上的MVC模式

和自甴很熟 提交于 2020-02-27 13:31:37
是否可以在Android版Java中实现模型-视图-控制器模式? 还是已经通过活动实施了? 还是有更好的方法来为Android实现MVC模式? #1楼 我认为最有用的简化说明在这里: http : //www.cs.otago.ac.nz/cosc346/labs/COSC346-lab2.2up.pdf 从我在这里看到和阅读的所有其他内容来看,实现所有这些东西会使它变得更加困难,并且与android的其他部分不太匹配。 通过活动实现其他侦听器已经是Android的标准方法。 最无害的方法是像幻灯片中描述的那样添加Java Observer,并将onClick和其他类型的操作分组为仍在Activity中的功能。 Android的方式是Activity可以同时执行。 对抗它并没有真正使扩展或将来编写代码变得更加容易。 我同意 第二个职位 。 它已经实现了,而不是人们习惯的方式。 无论是否在同一文件中,都已经存在分隔。 无需创建额外的分隔符以使其适合其他语言和操作系统。 #2楼 经过一番搜索,最合理的答案如下: MVC已在Android中实现为: View =布局,资源和诸如 android.view.View 派生的 Button 类的内置类。 控制器=活动 模型=实现应用程序逻辑的类 (顺便说一下,这意味着活动中没有应用程序域逻辑。) 对于小型开发人员而言

RoboGuice 3.0 NoClassDefFoundError: AnnotationDatabaseImpl

蓝咒 提交于 2020-01-14 09:49:09
问题 For some reason the RoboBlender does not generate the annotation database. My build.gradle has the following dependencies: dependencies { provided 'org.roboguice:roboblender:3.0' compile fileTree(dir: 'libs', include: ['*.jar']) compile 'org.roboguice:roboguice:3.0' } 回答1: This is not a final solution, but it can help you. I don't know why, but RoboGuice 3.0 and 3.0.1 throws this exception. What you have to do is disable annotations for databases in your MainActivity as follows: static {

Robolectric junit test - missing internet permission

╄→гoц情女王★ 提交于 2020-01-03 20:03:01
问题 I am developing some JUnit test for ma app. I need to use Robolectric + Roboguice libraries. What I am trying to do now is only simple test which checks if activity is not null. Here is my code: @RunWith(RobolectricGradleTestRunner.class) @Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP, application = TestBoomerangManagerApplication.class, manifest = "src/main/AndroidManifest.xml") public class SimpleTest { private DirectInviteEmployeesActivity activity; @Before

RoboGuice 3.0 NoClassDefFoundError: roboguice.inject.ContextScopedRoboInjector

两盒软妹~` 提交于 2020-01-03 08:32:37
问题 This is not always seen but seen on particular API 14 and 19. Below is the stacktrace java.lang.NoClassDefFoundError: roboguice.inject.ContextScopedRoboInjector at roboguice.RoboGuice.getInjector(RoboGuice.java:197) at roboguice.activity.RoboActivity.onCreate(RoboActivity.java:90) at com.bnmcombines.galleryflavors.Launcher.onCreate(Launcher.java:71) at android.app.Activity.performCreate(Activity.java:5343) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) at

Android Roboguice Exception

烂漫一生 提交于 2020-01-01 08:46:28
问题 Just starting my way with Roboguice for android. Tried implementing this simple context injection but getting this exception. I googled it and ran into quite a few posts but non solved my issue. This is the exception below, any ideas? Thanks in advance 02-05 00:14:54.330: I/dalvikvm(777): Failed resolving Lcom/google/inject/Provider; interface 627 'Ljavax/inject/Provider;' 02-05 00:14:54.330: W/dalvikvm(777): Link of class 'Lcom/google/inject/Provider;' failed 02-05 00:14:54.340: I/dalvikvm

Android Roboguice Exception

最后都变了- 提交于 2020-01-01 08:46:24
问题 Just starting my way with Roboguice for android. Tried implementing this simple context injection but getting this exception. I googled it and ran into quite a few posts but non solved my issue. This is the exception below, any ideas? Thanks in advance 02-05 00:14:54.330: I/dalvikvm(777): Failed resolving Lcom/google/inject/Provider; interface 627 'Ljavax/inject/Provider;' 02-05 00:14:54.330: W/dalvikvm(777): Link of class 'Lcom/google/inject/Provider;' failed 02-05 00:14:54.340: I/dalvikvm

Android Roboguice Exception

我与影子孤独终老i 提交于 2020-01-01 08:46:14
问题 Just starting my way with Roboguice for android. Tried implementing this simple context injection but getting this exception. I googled it and ran into quite a few posts but non solved my issue. This is the exception below, any ideas? Thanks in advance 02-05 00:14:54.330: I/dalvikvm(777): Failed resolving Lcom/google/inject/Provider; interface 627 'Ljavax/inject/Provider;' 02-05 00:14:54.330: W/dalvikvm(777): Link of class 'Lcom/google/inject/Provider;' failed 02-05 00:14:54.340: I/dalvikvm

Roboguice 2.0 (android): POJO injection error (always null)

孤人 提交于 2019-12-25 02:47:15
问题 My base POJO class: public class BaseDao { public BaseDao() { } // ... } My extends POJO class: public class KelvinDao extends BaseDao { public KelvinDao () { super(); } // ... } I want to use KelvinDao in a service like that: public class HanKelvinHandler extends HttpRequestHandler { @Inject private KelvinDao mKelvinDao; public void treatGet() { mKelvinDao.blabla(); !!! mKelvinDao is always NULL } It's really simple but it doesn't work :( Thank you guys for your help! 回答1: How are you

Injected views are null with RG 3.0

我的梦境 提交于 2019-12-24 05:34:09
问题 I am using RoboGuice 3.0 in Android Studio directly since I need support for ActionBarActivity. This is my dep: compile 'org.roboguice:roboguice:3.0' First odd thing I had to do was to resolve a ClassNotFoundException for "Unable to use annotation database(s)". It seems like if there's no annotation package given, the packageList is prepended with empty string and DI framework complains that it could not find AnnotationDatabaseImpl at root package (which is expected). So I did this in my

Maven, ActionBarSherlock v4 and Roboguice v2 - How do I get it to build?

不羁的心 提交于 2019-12-24 02:04:03
问题 I'm trying to build a project to uses both ActionBarSherlock v4 and Roboguice v2 (I like beeing of the bleeding edge :) ). The problem is that ABS uses a slightly modified compatibility library, that Roboguice needs. I got it working fine under Eclipse by adding actionbarsherlock-plugin-compat-lib-4.0.0-SNAPSHOT , roboguice-2.0b3 and the ActionBarSherlock project. Now the problem is that under Maven, I need to include the following dependency because of Roboguice: <dependency> <groupId