Back to project page RobolectricSample.
The source code is released under:
MIT License
If you think the Android project RobolectricSample listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.pivotallabs.injected; /*from ww w . j a va 2 s .c o m*/ import android.os.Bundle; import android.widget.TextView; import com.google.inject.Inject; import com.pivotallabs.R; import roboguice.activity.GuiceActivity; import roboguice.inject.InjectResource; import roboguice.inject.InjectView; import java.text.DateFormat; import java.util.Date; import java.util.Locale; public class InjectedActivity extends GuiceActivity { @InjectResource(R.string.injected_activity_caption) String caption; @InjectView(R.id.injected_text_view) TextView injectedTextView; @Inject Date date; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.injected); DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG, Locale.US); String formattedDate = dateFormat.format(date); injectedTextView.setText(caption + " - " + formattedDate); } }