Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8528213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:45:07+00:00 2026-06-11T08:45:07+00:00

Recently I downloaded Roboguice and gave it a try. In general I like it

  • 0

Recently I downloaded Roboguice and gave it a try. In general I like it and I think it could ease some aspects in Android development process, but I encountered a situation which didn’t find a solution yet: I want to inject a class, but that class has one, ore more constructors with several parameters.

In a such case, how would I specify which constructor to choose for instantiation, and pass the values to constructor?

For example I have the the class TestRobo with 2 constructors, and I want to instantiate the object from the second constructor, passing the firstName, lastName as parameters:

public class TestRobo implements ITestRobo {

    public TestRobo(String fullName) {
        //....
    }

    public TestRobo(String firstName, String lastName) {
        //...
    }
}

Right now, if I inject it like this:

@Inject
private ITestRobo testRobo;

It trows an exception that it couldn’t find a suitable constructor.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:45:08+00:00Added an answer on June 11, 2026 at 8:45 am

    You need to bind ITestRobo to its TestRobo implementation. You can either do this by adding the @ProvidedBy(TestRobo.class) annotation to ITestRobo, or you can add a module and bind(ITestRobo.class).to(TestRobo.class) in your configure() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently downloaded the Android Support Package and have been using it trying to
I recently downloaded Visual Studio 2010b2, and wanted to re-evaluate some of my questions
I recently downloaded python 2.7 on my computer (x64) and I would like to
Recently downloaded some code for a minor open-source project related to a small webgame
I recently downloaded the SO Data Dump and was wondering how I could convert
i recently downloaded some maven artifacts directly to my local repository (.m2/repository). Now i
I recently downloaded some pre-loaded shapes of Countries & Provinces into Sql Server 2008
I've recently downloaded Pygame for the first time on this computer. When I try
I am creating an Android Application and I recently downloaded a SQLite Database Browser.
I recently downloaded some samples to use with AppFabric caching. I noticed in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.