|
In fairness, you can go straight to the source and blame Java for that one, since they didn't decide that isEmpty() might be useful for strings until 1.6 The current state of fragmentation on Android is ridiculous though. I use Android in my data structures course and I hate that I still have to use 2.2 as my baseline for all the projects because that's what most of my students still have. And it really pisses me off that we bought a batch of Samsung 7" Galaxy Tabs last year for classroom use and we can't even upgrade those (officially) past 2.3. The only reason I can tolerate programming in Java anymore is because of Android, and I'm excited about when they finally get around to adding lambdas (maybe in Java 8?). But what are the chances I'd be able to use those on Android if I can't upgrade it? Not much, unless their implementation is all compile-time transformations and doesn't require JVM changes.
|
# ¿ Oct 16, 2012 13:18 |
|
|
# ¿ Apr 28, 2024 12:44 |
|
So I've been teaching an intro CS class using Android for the past year, and this semester I'm finally upgrading all my assignments' target SDKs from 2.2 to 4.0, while retaining as much compatibility as possible with other devices. One change I'm making is having students to more with action bars. So, I've created a menu that has 5 items, set showAsAction="always" on all of them. Overrode onCreateOptionsMenu to inflate it in my activity. On a 4.0 emulator, they all show up like I'd expect, and clicking them does the right thing. On a 2.2-2.3 emulator or device, the menu is loaded and appears properly when I click the Menu button, but clicking the items doesn't do anything. The menu doesn't even get dismissed. I tossed some logging statements in there, and onOptionsItemSelected is never being called. Even setting an onMenuItemClicked handler on the items themselves doesn't change anything. Has anyone seen this kind of behavior before? I'm not sure what's going on, and Googling has been futile so far. EDIT: I'm NOT using ActionBarSherlock or anything like that. Everything is standard Android APIs, and I'd rather not bring in third party libraries. Flobbster fucked around with this message at 03:18 on Feb 21, 2013 |
# ¿ Feb 21, 2013 03:15 |
|
By "intro" I don't mean a first-semester CS course. It's Intro to Software Design and Data Structures, so they already have plenty of experience with the basics of Java and can move on to more advanced stuff. We've developed some nice abstractions for them to use that get rid of a lot of the Android grunt-work, inspired by and stealing/improving ideas from frameworks like Roboguice, but I don't want to derail the thread talking about that -- unless people are interested It works better than it might sound at first, though.
|
# ¿ Feb 21, 2013 05:41 |
|
Freakus posted:I've been tasked with writing an android app when I have no experience with android. I was looking at google cloud messaging (gcm) and had a couple of clarifications related to the code of their example usage of gcm at: Huh? From the sample: code:
quote:2) Presumably we need to check GooglePlayServicesUtil.isGooglePlayServicesAvailable in any activity we use them, not just the main activity. Not every activity, just any that are an entry point into your application. If all your other activities are internal and only accessible starting from a main activity that checks for Play Services, you don't need to worry about doing it again there. quote:3) With the code given, it seems like the usage of registerInBackground may cause a race condition: what if you attempt to use gcm.send before the asynctask finishes? Is there something about android that will ensure this never happens in the sample code? So make sure you don't call gcm.send before the task finishes. Break up your code so that you use the task's onPostExecute method as a "continuation" so that you only call it after you're sure it's ready.
|
# ¿ Nov 9, 2013 19:01 |