Questions tagged [roboguice]

Roboguice brings the power and testability of using the Google Guice dependency injection framework to Android application development.

RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library.

Useful links

329 questions
0
votes
2 answers

Roboguice ViewInjection in custiom views.

I have a problem: I create fragment and than add it to activity with TranactionManager.replace() public class Main extends RoboActivity { @Override protected void onCreate(Bundle savedInstanceState) { …
0
votes
1 answer

Roboguice - Two implementations for one interface

My code is like this: interface MyIntreface{ ... } class A implements MyInterface{} class B implements MyInterface{} class BaseClass{ @Inject MyInterface instance; } class MyFirstClass extends BaseClass{ .... } class…
user1763198
  • 83
  • 1
  • 10
0
votes
1 answer

How to inject a google guava eventbus as a global singleton using Roboguice in android?

How do I set up Roboguice to use the same instance of eventbus when injected into my Activities and Broadcast Receivers like this: @Inject EventBus eventBus; That is to say: As far as I understand, the event bus must be a global process singleton…
JohnRock
  • 6,795
  • 15
  • 52
  • 61
0
votes
1 answer

Dependency injection: binding to specific value of a constructor parameter

Background I'm writing an application in Java and I'm using Guice for DI. (It's Android and RoboGuice to be exact, although it probably makes no difference in this context). Class design It's an app for keeping score for a popular cardgame -…
Konrad Morawski
  • 8,307
  • 7
  • 53
  • 91
0
votes
1 answer

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

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…
anthony
  • 7,653
  • 8
  • 49
  • 101
0
votes
0 answers

Testing activity in a custom application

I have a custom application called MainApplication. The activity I am testing references the application context. The code looks like this: @Override protected void onCreate(final Bundle savedInstanceState) { …
Grace Huang
  • 5,355
  • 5
  • 30
  • 52
0
votes
4 answers

How to manage an activity from an AsyncTask

I have two activities (Activity1 and Activity2) and one AsyncTask (AsyncTask1) Activity1 has a button that on click gives control to Activity2, Activity2 has an AsyncTask and in that task's onPostExecute() I want to handle a TextView that is in…
Anthony
  • 33,838
  • 42
  • 169
  • 278
0
votes
1 answer

RoboGuice @Observes do not work in release build

I'm using RoboGuice's EventManager in my app as shown here https://code.google.com/p/roboguice/wiki/Events#Creating_your_Own_Events and it works perfectly in debug build, but the events do not trigger in release build - probably due to ProGuard…
Iftah
  • 9,512
  • 2
  • 33
  • 45
0
votes
3 answers

List is not getting created in R.java

When I try to set an adapter to list like list.setAdapter(adapter); I get an exception because list is null at this line of execution in FromPageActivity.java. If my understanding is right, since I am using Roboguice, @ViewById should initialize…
0
votes
1 answer

Boot Strapping RoboGuice

I am trying out RoboGuice-Sherlock in a application. I wrote a custom Binding that uses a provider. public class ActionBarProvider implements Provider{ @Override public ActionBar get() { return new…
Mario Dennis
  • 2,986
  • 13
  • 35
  • 50
0
votes
1 answer

How to get roboguice's bindings

I am using RoboGuice and Gson in my application at some point, i need gson to inject a json into an interface, however, Gson doesnt know how to inject an interface, unless you provide an instance creator, that maps between an implementation class…
Lena Bru
  • 13,521
  • 11
  • 61
  • 126
0
votes
0 answers

guice java.lang.ClassCastException: Object_Proxy cannot be cast to android.net.ConnectivityManager

Hello I am using RoboGuice and Mockito in my project I am facing problems resolving SystemServices in test... I made a class public class RoboInstrumentationTestCase extends InstrumentationTestCase { protected Application application; protected…
Darien Alvarez
  • 153
  • 2
  • 10
0
votes
1 answer

Inject dependencies into views with roboguice

Activity fields: public class MyActivity extends RoboActivity { @InjectView(R.id.my_view) protected MyView myView; @Inject private MyDependency myDependency; // onCreate etc } View fields: public class MyView extends…
fracz
  • 20,536
  • 18
  • 103
  • 149
0
votes
1 answer

Which version to use for RoboGuice

I'm starting a new project and would like to use Sherlock and RoboGuice, I saw there are some examples to combine both, but while browsing RoboGuice GitHub I realized the author actually added the combined classes, however the .jar the wiki advices…
Kenny D.
  • 927
  • 3
  • 11
  • 29
0
votes
1 answer

Should I inject everything using DI with RoboGuice?

I'm currently developing some App using RoboGuice. My question is: should I realy inject everthing ? Should every class I've created have its own contract interface ? This question came to my head after my troubles with naming interface for one of…
user1321706
  • 107
  • 2
  • 8