[android-developers] ANNOUNCE: RoboGuice 1.1 now available
Hello Android developers, I'd like to announce the final release of RoboGuice 1.1! http://roboguice.org RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library. If you've ever used Spring (the #1 enterprise framework on Java, more popular than JEE itself) or Guice, you already know how convenient this style of programming can be. To give you an idea, take a look at this simple example of a typical Android activity: class AndroidWay extends Activity { TextView name; ImageView thumbnail; LocationManager loc; Drawable icon; String myName; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name = (TextView) findViewById(R.id.name); thumbnail = (ImageView) findViewById(R.id.thumbnail); loc = (LocationManager) getSystemService(Activity.LOCATION_SERVICE); icon = getResources().getDrawable(R.drawable.icon); myName= getString(R.string.app_name); name.setText( Hello, + myName ); } } This example is 18 lines of code. If you're trying to read through onCreate(), you have to skip over 5 lines of boilerplate initialization to find the only one that really matters: name.setText(). And complex activities can end up with a lot more of this sort of initialization code. Compare this to the same app, written using RoboGuice: class RoboWay extends RoboActivity { @InjectView(R.id.name) TextView name; @InjectView(R.id.thumbnail)ImageView thumbnail; @InjectResource(R.drawable.icon) Drawable icon; @InjectResource(R.string.app_name) String myName; @InjectLocationManager loc; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name.setText( Hello, + myName ); } } In this example, onCreate() is much easier to take in at a glance. All the platform boilerplate is stripped away and you're left with just your own app's business logic. Do you need a SystemService? Inject one. Do you need a View or Resource? Inject those, too, and RoboGuice will take care of the details. RoboGuice's goal is to make your code be about your app, rather than be about all the initialization and lifecycle code you typically have to maintain in Android. RoboGuice has been in development since August 2009. 1.0 was release in March of 2010, and since then has become the #1 dependency injection framework on Android, used in several big name Android applications. 1.1 has been baking for about 10 months and is pretty stable at this point. What's new in RoboGuice 1.1? + Maven support + Testing support + Improved performance + Improved logging + A very cool Event system + And more: http://code.google.com/p/roboguice/wiki/ReleaseHistory We know that RoboGuice won't be for everybody. Although RoboGuice never prevents you from doing things the Android way, some people will still prefer seeing everything spelled out explicitly in their code. And other people who write extremely high performance applications such as games may not want to incur the small overhead imposed by yet another framework. But for people who want to build simple and straightforward code that's easily testable and easy to read, I encourage you to give RoboGuice a try. We hope you like it. Stop by our discussion forums if you'd like to have any help getting started. Cheers, Mike PS. 1.1 owes a lot to its many contributors. I'd like to shout out to: Manfred Moser, Adam Tybor, John Ericksen, Pierre-Yves Ricau, Tolik N_A, Christine Karman, Stephen Ng, Paul Butcher, Donn Felker, the robolectric guys at PivotalLabs, the sonatype guys, and Sam Berlin at google guice. Thank you for all your help and contributions! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Even with Min SDK version, building app against 2.2 breaks 1.5?
Okay, so I followed the instructions in this thread as far as I'm able to tell but I'm getting a FileNotFoundException whenever the 1.5 emulator tries to access a particular image in the drawable directory. I have two drawable directories: drawable and drawable- hdpi-v4. Any idea why this shouldn't work? More details here: http://stackoverflow.com/questions/3357816/notfoundexception-and-filenotfoundexception-when-running-app-on-android-1-5 Cheers, Mike On Jun 9, 5:02 am, Eric F ericfrie...@gmail.com wrote: Wow this completely explains what happened to me after updating to the 2.2 SDK. The documentation goes into detail about how the current environment picks hdpi or ldpi or what have you, but doesn't explain how previous versions operate at all. From a beginner's mindset, it seems to follow that since 1.5 wasn't dpi aware that it wouldn't read resources out of any folder containing a dpi setting (even mdpi). But this is not the case and it took me trial and error to understand the way it works. It is also not clearly mentioned that the solution is to do a hdpi-v4 and ldpi-v4 directory and an mdpi directory. In fact this was specifically not the solution recommended at Google IO a couple of days ago. So in conclusion, thanks for finally revealing how this works now (and has worked in previous androids) Dianne, and I would gladly write up a documentation patch but I don't think the d.android.com articles are in gerrit right? -Eric On Jun 8, 8:57 pm, Dianne Hackborn hack...@android.com wrote: Um, no, you should use -hdpi-v4 so that v3 of the platform does not see the hdpi resource (which it does not understand) as a possibility. Also as of 2.2 aapt will automatically include the appropriate minimum version for new configurations, so that older platforms do not see them. Though I notice that it uses -v4 for a resource that has ANY density specified, so if you don't have default resources for images you may break on 1.5. That is, you'd want drawable/, drawable-hdpi/, etc; and aapt will turn this in to drawable/ and drawable-hdpi-v4/ for you. If you have drawable-mdpi/ and drawable-hdpi/ you will end up with drawable-mdpi-v4/ and drawable-hdpi-v4, neither of which v3 (1.5) can accept. I should probably leave -mdpi as not having a version config... I think 1.5 can still handle those, though I'll have to check. (Note aapt also adds -v4 for -normal, -large, -small, -long, and -notlong; and -v8 for -car, -desk, -night, and -notnight.) -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Announcing RoboGuice 1.0
Hi Matthias, I'm with you on the sluggishness issues. I had to dial-back my use of libraries like gson because the overhead just ended up being too high. In my experience, run-time impact of RoboGuice isn't that high. As I was telling Manfred a few days ago, I notice zero impact on the Nexus One or Droid. For older devices, it's possible to notice an impact during activity startup if you're looking for it, but it's fairly innocuous. Reading reviews of apps that use RoboGuice indicates that it doesn't seem to be something users are generally aware of. I've got an action item (Issue #33) to publish some benchmarks at some point. Battery impact should be negligible as roboguice doesn't really do anything in the background. APK size is an issue though. Right now roboguice+guice adds about 450k (400 of that is just guice). I think proguard could probably take out much or most of that impact, but I haven't had a chance to get it working yet. In fact, if anyone is up for the challenge, I'd totally offer up a license to IntelliJ 9 to anyone who can supply detailed instructions on how to use Proguard with a roboguice android app. Any takers? :) Cheers, Mike On Apr 4, 2010, at 6:12 AM, Matthias wrote: I was thinking about using Guice myself before, but hesitated fearing to make the overall sluggishness of the platform even worse. How much of an overhead are talking about in terms of memory footprint and size of bundled libraries? Any noticeable impacts on speed or battery life? How often does Guice kick in in the background? I'm currently stepping back from overly abstract programming models on Android because of exactly these issues. On Mar 29, 8:53 pm, Michael Burton m...@niskala.org wrote: Hello Android developers, I'd like to announce the final release of RoboGuice 1.0! http://code.google.com/p/roboguice RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library. If you've ever used Spring (the #1 enterprise framework on Java, now more popular than J2EE itself) or Guice, you already know how convenient this style of programming can be. To give you an idea, take a look at this simple example of a typical Android activity: class AndroidWay extends Activity { TextView name; ImageView thumbnail; LocationManager loc; Drawable icon; String myName; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name = (TextView) findViewById(R.id.name); thumbnail = (ImageView) findViewById(R.id.thumbnail); loc = (LocationManager) getSystemService(Activity.LOCATION_SERVICE); icon = getResources().getDrawable(R.drawable.icon); myName= getString(R.string.app_name); name.setText( Hello, + myName ); } } This example is 18 lines of code. If you're trying to read through onCreate(), you have to skip over 5 lines of boilerplate initialization to find the only one that really matters: name.setText(). And complex activities can end up with a lot more of this sort of initialization code. Compare this to the same app, written using RoboGuice: class RoboWay extends GuiceActivity { @InjectView(R.id.name) TextView name; @InjectView(R.id.thumbnail)ImageView thumbnail; @InjectResource(R.drawable.icon) Drawable icon; @InjectResource(R.string.app_name) String myName; @InjectLocationManager loc; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name.setText( Hello, + myName ); } } In this example, onCreate() is much easier to take in at a glance. All the platform boilerplate is stripped away and you're left with just your own app's business logic. Do you need a SystemService? Inject one. Do you need a View or Resource? Inject those, too, and RoboGuice will take care of the details. RoboGuice's goal is to make your code be about your app, rather than be about all the initialization and lifecycle code you typically have to maintain in Android. RoboGuice has been in development since August 2009, and 0.9 entered release candidacy in December and has been stabilizing ever since. After three months and a few finishing touches, we now believe it's ready to expose to a larger audience. We know that RoboGuice won't be for everybody. Although RoboGuice never prevents you from doing things the Android way, some people will still prefer seeing everything spelled out explicitly in their code. And other people who write extremely high performance applications such as games may not want to incur the small overhead imposed by yet another framework. But for people who want to build simple and straightforward code that's easily testable and easy to read
Re: [android-developers] Re: Announcing RoboGuice 1.0
Hi ko5tik, Good idea, I agree that injection is not as simple as it should be for objects instantiated manually. I've added your suggestion here: http://code.google.com/p/roboguice/issues/detail?id=34 When you say you're not happy with inheritance, could you be more specific? Do you mean how Activities need to inherit from GuiceActivity instead of Activity? I'm glad to see you here! It's great to have developers who know DI inside and out. Cheers, Mike On Apr 6, 2010, at 2:37 PM, ko5tik wrote: Hi Michael, Being developer of pico I'm also watching what you are doing ;) Currently I'm not very happy with size (could/should be less) and inheritance. Though inheritance problem could be solved easily - Just create static method which will inject supplied object out of context: RoboGuice.inject(this) This (IMHO) would be less intrusive for users. But I think there is more room for DI on android - not only in interface creation ( I play with ideas to adapt pico, but its core is currently too big ) regards, On Apr 6, 4:38 pm, Michael Burton m...@niskala.org wrote: Hi Matthias, I'm with you on the sluggishness issues. I had to dial-back my use of libraries like gson because the overhead just ended up being too high. In my experience, run-time impact of RoboGuice isn't that high. As I was telling Manfred a few days ago, I notice zero impact on the Nexus One or Droid. For older devices, it's possible to notice an impact during activity startup if you're looking for it, but it's fairly innocuous. Reading reviews of apps that use RoboGuice indicates that it doesn't seem to be something users are generally aware of. I've got an action item (Issue #33) to publish some benchmarks at some point. Battery impact should be negligible as roboguice doesn't really do anything in the background. APK size is an issue though. Right now roboguice+guice adds about 450k (400 of that is just guice). I think proguard could probably take out much or most of that impact, but I haven't had a chance to get it working yet. In fact, if anyone is up for the challenge, I'd totally offer up a license to IntelliJ 9 to anyone who can supply detailed instructions on how to use Proguard with a roboguice android app. Any takers? :) Cheers, Mike On Apr 4, 2010, at 6:12 AM, Matthias wrote: I was thinking about using Guice myself before, but hesitated fearing to make the overall sluggishness of the platform even worse. How much of an overhead are talking about in terms of memory footprint and size of bundled libraries? Any noticeable impacts on speed or battery life? How often does Guice kick in in the background? I'm currently stepping back from overly abstract programming models on Android because of exactly these issues. On Mar 29, 8:53 pm, Michael Burton m...@niskala.org wrote: Hello Android developers, I'd like to announce the final release of RoboGuice 1.0! http://code.google.com/p/roboguice RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library. If you've ever used Spring (the #1 enterprise framework on Java, now more popular than J2EE itself) or Guice, you already know how convenient this style of programming can be. To give you an idea, take a look at this simple example of a typical Android activity: class AndroidWay extends Activity { TextView name; ImageView thumbnail; LocationManager loc; Drawable icon; String myName; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name = (TextView) findViewById(R.id.name); thumbnail = (ImageView) findViewById(R.id.thumbnail); loc = (LocationManager) getSystemService(Activity.LOCATION_SERVICE); icon = getResources().getDrawable(R.drawable.icon); myName= getString(R.string.app_name); name.setText( Hello, + myName ); } } This example is 18 lines of code. If you're trying to read through onCreate(), you have to skip over 5 lines of boilerplate initialization to find the only one that really matters: name.setText(). And complex activities can end up with a lot more of this sort of initialization code. Compare this to the same app, written using RoboGuice: class RoboWay extends GuiceActivity { @InjectView(R.id.name) TextView name; @InjectView(R.id.thumbnail)ImageView thumbnail; @InjectResource(R.drawable.icon) Drawable icon; @InjectResource(R.string.app_name) String myName; @InjectLocationManager loc; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); name.setText( Hello, + myName ); } } In this example, onCreate() is much easier to take in at a glance. All
[android-developers] Re: RoboGuice
Glad you like it, Christine! Please let me know if you have any suggestions for improvements. Cheers, Mike On Jan 25, 4:19 am, Christine christine.kar...@gmail.com wrote: I'm usingRoboGuice, for a few days now, and so far I like it. Does anyone else useRoboGuice? http://code.google.com/p/roboguice/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: HttpURLConnection getResponseCode
Reviving an old thread here, but I found a solution that works for me at least. Turned out to be a problem with http.keepAlive: http://stackoverflow.com/questions/1440957/httpurlconnection-getresponsecode-returns-1-on-second-invocation I don't know exactly why that's solving the problem, but the workaround does work for me. Is this possibly a bug in Android? Cheers, Mike On Oct 27 2008, 7:28 am, Michael Bleigh mble...@gmail.com wrote: Add me to the list of people who are experiencing this problem. Anyone have solutions? On Oct 16, 11:43 pm, Gil virgildobjans...@gmail.com wrote: I learned more about the problem. It always occurs after I cancel a GET request. By cancel I mean quit the loop that reads from the input stream, disconnect theHttpURLConnectionand quit the thread which runs the connection. NextHttpURLConnectionI create exhibits the problem described above. If I restart my application using Eclipse the problem goes away. It also goes away some time after the canceled GET request (simply wait a 30 seconds to a minute). On Oct 16, 5:15 pm, androidian ianmcint...@gmail.com wrote: I have the same problem. No idea what's happening. On Oct 16, 4:04 pm, Gil virgildobjans...@gmail.com wrote: I have a class that implements anHttpURLConnection. The class works fine most of the time. Once in a while when I perform a GET operation getResponseCode returns -1. Does anyone know under what circumstances getResponseCode returns -1? The documentation states: the response code, -1if no valid response code. Ethereal shows that the GET request has been sent but that no bytes have been received. Also, the getResponseCode does not time out. When it fails it does so without waiting at all (typically 100ms). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Transparency on Views behaving differently in 1.5
Please enter a bug at http://b.android.com with a working piece of code that exhibits the issue and SDK details (sdk, OS, emu vs device, etc.) Thanks in advance. Not filed by me, but I just found it when searching b.android.com: http://code.google.com/p/android/issues/detail?id=2458 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Android 1.1_r1 SDK released and developer.android.com launched
Don't see a clear response to this, has anyone found the tag for the 1.1 r1 release in the source repository? Cheers, Mike On Feb 14, 2:59 pm, blake blake.me...@gmail.com wrote: Justin, For those of us following along at home, is there a tag or branch, in the source that corresponds to the 1.1 release? Thanks! -blake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---