January 2018

S M T W T F S
  123456
78910111213
14151617181920
21222324252627
28293031   

Style Credit

Expand Cut Tags

No cut tags
Tuesday, November 2nd, 2010 02:25 pm
Today's hack is up. It's to the flashlight app again; now the UI stays in portrait orientation no matter how you rotate the phone. This prevents the pause/resume/create cycle that was killing my Activity and causing the light to go out. Most of yesterday's code is no longer needed and has been taken out again, but that's a good thing, right? :-)

Sideload the app (if you care - HTC Sense has such a thing built-in) from here.

Anyway, the way you do this is by adding the attribute android:screenOrientation="portrait" to the activity element in your manifest. This tip came from this StackOverflow post: I tried the more complicated "add a configChanges attribute and override onConfigurationChanged" approach described there, but that resulted in the LED wedging in whatever state it was in when you rotated the phone and not accepting any further changes. God knows what was going on there.

By the way, does anyone use git add -p much? I tried the "edit this hunk" feature a couple of times, but it told me that it my patch wouldn't apply cleanly, and then rejected the whole thing. Also, I'm having trouble uploading files to GitHub's "download" section.

Edit: and I've had a documentation patch accepted into Idris. Go me!
Tuesday, November 2nd, 2010 04:27 pm (UTC)
I'd love it if you could try out my app and let me know how you get on with it.
Tuesday, November 2nd, 2010 04:47 pm (UTC)
Hm. I download the package, select it in the notifications pull-down, select "OK" to install it, and then it says "Application not installed". Downloading it to my mac, plugging the phone in and running "adb install LEDFlashlight-0.3.apk" results in the following:

482 KB/s (14166 bytes in 0.028s)
pkg: /data/local/tmp/LEDFlashlight-0.3.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]


I have non-Market installations enabled on the phone, and I can install apps that I've compiled myself.
Tuesday, November 2nd, 2010 05:11 pm (UTC)
I didn't realise you needed to sign apps before other people could use them - d'oh! It should be fixed now - try it again?
Tuesday, November 2nd, 2010 05:24 pm (UTC)
Works very nicely. All you need now is a nifty icon. :-)
Tuesday, November 2nd, 2010 05:40 pm (UTC)
More precisely, I need fifteen nifty icons, conforming to the extensive design guidelines (http://developer.android.com/guide/practices/ui_guidelines/icon_design.html). A job for tomorrow, I think :-)