**** BEGIN LOGGING AT Thu Mar 20 02:59:56 2008 Mar 20 03:22:07 are people here making android apps? Mar 20 04:30:00 romainguy: how would i manually scale a bitmap? i want to download an image once, but store many scaled copies of it on disk as a cache Mar 20 04:30:30 create a new Bitmap of the target size Mar 20 04:30:34 create a Canvas Mar 20 04:30:41 pass the new bitmap to the Canvas' constructor Mar 20 04:30:47 draw the large bitmap on the canvas Mar 20 04:31:18 ok, and this is reasonably well optimized? Mar 20 04:31:37 depends on what you're doing Mar 20 04:32:06 final Bitmap.Config c = Mar 20 04:32:06 icon.getOpacity() != PixelFormat.OPAQUE ? Mar 20 04:32:07 Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565; Mar 20 04:32:07 final Bitmap thumb = Bitmap.createBitmap(width, height, c); Mar 20 04:32:07 final Canvas canvas = new Canvas(thumb); Mar 20 04:32:07 canvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG, 0)); Mar 20 04:32:18 and then canvas.drawBitmap(bitmap, left, top, width, height...) Mar 20 04:32:25 that's code straight from the Home app Mar 20 04:32:35 it's with my music player, i download a single 160x160 image of album artwork when the sync engine sees a new album. Mar 20 04:32:58 the phone should then make a 50x50 and 84x84 copy on disk that can be accessed for the album list and song list screens Mar 20 04:33:05 that will be fast Mar 20 04:33:43 and then i just have a content uri like content://.../artwork/50x50 /artwork/84x84, etc. Mar 20 04:33:49 is anyone using the cameradevice? Mar 20 04:34:37 romainguy: actually though, i am just scaling on the fly right now and it's not nearly as slow as i'd imagined Mar 20 04:34:46 it's not Mar 20 04:34:51 depends on what you do Mar 20 04:34:56 try do to on the fly scaling in a scrolling grid Mar 20 04:35:03 then you'll experience pain Mar 20 04:35:14 but one shot drawings are just fine Mar 20 04:35:15 i will still cache the appropriate size ahead of time :) Mar 20 04:39:27 won't really make much of a difference at drawing time but that will definitely save disk space Mar 20 04:39:46 actually you could do the resizing on the server instead :) Mar 20 04:40:47 romainguy: am i reading that code correctly to show that dithering is disabled? is that normally on? Mar 20 04:41:01 it's on by default yes Mar 20 04:41:07 don't bother with this Mar 20 04:41:13 is specific to what home's doing Mar 20 04:41:39 ok :) Mar 20 04:42:17 is the scaling really so efficient that i shouldn't worry about doing it on the fly? seems counter-intuitive to me considering i'll have an enormous amount of images. Mar 20 04:42:37 the reason i get the 160x160 image from the server is because i, occassionally, want to display the large version to the user. Mar 20 04:42:44 but it's far more common that i show the 50x50 version. Mar 20 04:43:01 romainguy: are there any plans to add functionality for runtime classes? Mar 20 04:43:26 jerkface03: what runtime classes? Mar 20 04:43:39 jasta: again, it depends where and when you draw them Mar 20 04:43:49 jasta: if it's when the song plays, you can do it on the fly Mar 20 04:43:55 if it's in a scrolling list, don't do it on the fly Mar 20 04:44:03 romainguy: as in loading up a class from any source. pass in an inputstream, class is loaded up, and i guess you'd be able to access it using the reflection apis Mar 20 04:44:09 ok, that's what i was wondering about. it is in the scrolling list. Mar 20 04:44:37 romainguy: more specifically, loading it up for your application while your application is already loaded up and running Mar 20 04:44:40 jerkface03: Maybe, I don't know Mar 20 04:44:48 I guess it's possible since OSGi works on Android Mar 20 04:45:06 jasta: actually, I take that back Mar 20 04:45:13 jasta: ListView will do the caching for you :) Mar 20 04:45:26 especially if you use android:alwaysDrawnWithCache="true" Mar 20 04:47:11 it sort of felt that way, since i was surprised to find that the performance was not terrible. Mar 20 04:47:31 well Mar 20 04:47:50 you're not doing a huge scaling anyway Mar 20 04:48:17 what would suck is if you had a scaled image as your activity background Mar 20 06:27:48 is anyone working on camera applications? Mar 20 06:28:02 how many apps do people predict will be submitted for this $25k deadline? Mar 20 06:29:08 probably alot? Mar 20 06:30:04 i don't see too much source code out there, are people being kinda secret probably till the deadline? Mar 20 06:30:15 maybe Mar 20 06:30:39 haha, you're a regular magic 8-ball jerkface03 Mar 20 06:30:50 it is possible ;) Mar 20 06:30:51 rhett: i am not releasing my source code until round 1 is complete (in April) Mar 20 06:31:02 but my project is to be opened at that point. Mar 20 06:31:58 50 is a lot of prizes, I wonder if there will be 500 decent entries Mar 20 06:32:13 yeah, odds seem pretty good. Mar 20 06:32:21 I suck at java. what is this icicle thing? Mar 20 06:32:29 i am not all that interested in the prize money though. Mar 20 06:32:41 jasta, what are you interested in? Mar 20 06:32:42 i have just always really wanted to get my app out there, and i think android is the way to do it. Mar 20 06:32:47 bonus that they might give me some money for it :) Mar 20 06:33:12 yeah jasta, I'm thinking that these handheld devices could be as big as developing for the web is now, in a few years Mar 20 06:33:31 these devices are more powerful than the computer I owned a few years ago Mar 20 06:33:33 Android is quite pleasant compared to many other mobile platforms. That's for sure. Mar 20 06:33:52 From a developer's perspective, I mean. Mar 20 06:33:56 well, especially if you know java Mar 20 06:34:18 rhett: The icicle thing is just a collection of values that are stored and recovered as the app freezes and thaws. Mar 20 06:34:30 Just a way to hold state while the user browses away from your app and then back to it. Mar 20 06:34:37 i see Mar 20 06:35:18 why, in the lunarlander source, is there so many variables that begin with an "m"? Mar 20 06:35:21 rhett: There is no excuse you should have to not simply learn whatever tool is necessary to accomplish the task at hand. In this case, that's Java. Mar 20 06:35:31 mLunarView.etc. Mar 20 06:35:41 rhett: the m prefix is used to signify global variables i think Mar 20 06:35:54 that is a convention that Android developers use, to mean that the variable is a member variable. Mar 20 06:36:02 right, member Mar 20 06:36:04 as opposed to, say, a local variable. Mar 20 06:36:06 i was thinking about g ;x Mar 20 06:36:33 cool, thanks a lot guys Mar 20 06:36:48 i'm sure this stuff is in the docs somewhere Mar 20 06:37:08 No, that's just a convention. Mar 20 06:40:53 jasta: what are you working on? the VNC thing still? Mar 20 06:41:40 no Mar 20 06:42:23 jasta: well what are you working on? or are you keeping your idea a secret? Mar 20 06:43:36 it's hard to describe in one short sentence, but it is basically a music player that lets you effectively access your entire music collection from your home computer OTA, integrating various other services like last.fm to enhance the experience Mar 20 06:43:55 jasta: sounds pretty neat. Mar 20 06:44:41 cool jasta Mar 20 06:45:34 i also intend to later support things like images, video, etc. Mar 20 06:46:34 i suppose it's kind of niche. part of the reason i want it is because i hate synchronizing my iPod or phone with my computer every time i get new music. and even then, i have 90GB+, which won't fit on any device I know of. Mar 20 06:47:06 jasta, i also can't sync my iphone with linux without hacking it Mar 20 06:47:22 also, i like to go for walks at lunch, but combined with my aforementioned laziness i can't be bothered to download my latest obsession ahead of time Mar 20 06:47:57 plus, the music experience is going to be much better than a stand-alone iPod for example. Mar 20 06:47:58 and yeah, while the apple solutions are often "sleek" i also find them really restrictive and annoying Mar 20 06:48:37 i'm very disappointed with the iPhone in particular. they no more combined a phone and an iPod than i could do with duct tape. Mar 20 06:49:18 well, compared to owning a razr, the iphone was very nice Mar 20 06:49:42 sure, but they didn't leverage the phone's data connection for any significant purpose in the music player. Mar 20 06:50:05 there is a wealth of meta data on music available on the internet that can be meaningfully integrated into simple music players Mar 20 06:50:06 yeah they did, you can connect to itunes from the home screen ;) Mar 20 06:50:33 for example, last.fm can give the user a sort of "what i like right now" auto playlist, and have contextual screens to jump to similar artists, popular songs, etc. Mar 20 06:51:04 so google is going to lose this 700Mhz deal? Mar 20 06:51:19 but we expect gphone handsets by the end of the year? Mar 20 06:51:19 verizon wins it Mar 20 06:51:21 * jasta wanders off back to work Mar 20 06:51:40 yeah gphone handsets coming soon Mar 20 06:51:43 probably just for development Mar 20 06:52:24 gphone devices are expected to hit the market later this year Mar 20 07:10:51 hmm, how do i achieve that dropshadow effect that we see in the window title? Mar 20 07:13:32 i see their camerapreview sample, but I don't understand where I'm susposed to save camera images Mar 20 07:14:19 that hasn't been well established yet. presumably, in a content provider for camera images or maybe just the media one. Mar 20 07:14:37 the andorid framework is not complete, and there is evidence all over. Mar 20 07:15:31 I want to make an application that basically lets me do a mini-blog, taking photos and adding text Mar 20 07:15:59 <_avatar> hey jasta, sorry to bug you directly, but did you see my question a little while ago? Mar 20 07:16:01 for that then you could store the images wherever you want. to the sdcard if it exists, your application folder, whatever. Mar 20 07:16:02 i guess there will be a million uses for that, but it won't look good if the camera sucks i guess Mar 20 07:16:06 _avatar: no? Mar 20 07:16:20 <_avatar> jasta: you mentioned you're making a music player... have you ever had problems with MediaPlayer intermittently not working, or even crashing your activity? Mar 20 07:16:43 oh yes, i've had _many_ problems with the MediaPlayer. it's extremely broken, it seems. Mar 20 07:17:19 <_avatar> ah, ok. was talking to zhobbs earlier and he experiences the same problems I do... was hoping there was someone who managed to get it working well :) Mar 20 07:33:47 Hi, I am new to android....I need ur help..... Mar 20 07:34:06 welcome. Mar 20 07:35:37 How can I trap the event of dragging my map to any location....suppose I have map application and initial set the longitude and latitude to show the currently location on map then now I want to trap the event on drag of my map to another location Mar 20 07:38:34 is anybody there to help me? or my question is not clear? Mar 20 07:39:41 i dont know the answer to it, personally. Mar 20 07:39:45 i have not worked with the map view at all Mar 20 07:40:00 no problem jasta....thanks for that Mar 20 07:41:02 anybody else to help me out :-( Mar 20 07:57:34 niket: Do you need to keep track of the lat/long while you move the map, or does the user do something else to make use of the lat/long (such as clicking a button)? Mar 20 08:00:20 HI Dan, I just need the exact event to trap when we drag my map to another location... Mar 20 08:00:52 right now I am dragging the map using mouse pointer Mar 20 08:01:07 right, I understand... Mar 20 08:01:43 but do you need the lat/long while you are dragging it, or after you release the mouse button Mar 20 08:02:38 I have used mapview a bit, but not sure I've done what you are trying to do Mar 20 08:03:28 you might look at overriding onTouchEvent Mar 20 08:03:46 no I don't need lat/long....I just need the event trap on release of mouse....I can get long/ lat using MapView.getLongitudeSpan() like that Mar 20 08:04:10 I looked the onTouchEvent but it is called whenever I touch the screen... Mar 20 08:04:18 right, you have to do some handling in it Mar 20 08:04:23 let me look at something... Mar 20 08:04:45 I am looking for the event which trap the dragging of map and called on release of mouse Mar 20 08:05:07 I think you want to only handle when event.getAction() == MotionEvent.ACTION_UP Mar 20 08:05:59 ok...let me check Mar 20 08:06:44 which method to override to call this line of code Mar 20 08:07:14 I think you'll have to extend MapView and override onTouchEvent Mar 20 08:09:11 thanks Dan, I appreciate ur help...let me try this :-) Mar 20 08:09:35 ok, I'll try to stick around for a bit longer to help if it doesn't work Mar 20 08:11:04 thanks Dan, I will let u know when it works Mar 20 08:12:25 Dan, it worked, I used ev.getAction() == MotionEvent.ACTION_MOVE Mar 20 08:12:35 :-) Mar 20 08:13:57 cool Mar 20 08:31:37 wtf Mar 20 08:31:59 Thread.isAlive() just threw an AIOOB exception Mar 20 08:32:42 http://pastebin.com/m3a22b51c Mar 20 08:32:47 any thoughts? Mar 20 08:50:55 re Mar 20 10:01:22 romainguy: still awake? Mar 20 10:01:39 yes Mar 20 10:01:55 romainguy_: don't know if you already know about this but http://pastebin.com/m3a22b51c Mar 20 10:02:05 Thread.isAlive() seems to be throwing an AIOOB in very rare cases Mar 20 10:02:08 possibly a race condition Mar 20 10:02:51 how come your view is making a call to Thread.isAlive() in onDraw()?! Mar 20 10:03:12 trust me, you don't want to know ;x Mar 20 10:03:48 regardless Mar 20 10:04:30 it shouldn't be throwing that exception no matter where it's called afaik Mar 20 10:05:28 file a bug Mar 20 10:06:14 well i'm trying to get it to reproduce but i can't ;x Mar 20 10:06:22 if i can find a way to reproduce it, i'll file a bug Mar 20 10:06:34 just wanted to let you know Mar 20 10:06:45 ok thanks Mar 20 10:36:45 http://code.google.com/android/reference/android/content/ContentResolver.html#getDataFilePath(android.net.Uri) Mar 20 10:36:47 lol Mar 20 11:12:15 i have some ideas for applications where I want people to plug in sensors. Is that likely to be possible? Mar 20 11:13:06 like a temperature sensor Mar 20 11:35:41 probably Mar 20 11:35:43 USB? Mar 20 11:36:22 yeah Mar 20 11:36:34 how would I include a usb temperature sensor? Mar 20 11:36:39 is that not possible now? Mar 20 12:16:45 well I guess you would need to build the drivers for your sensor Mar 20 12:17:41 there is a sdcard system Mar 20 12:17:57 if your sensor creates data on the sdcard, you could begin to program it that way Mar 20 12:19:53 well, I just want to make a temperature sensor, so it just outputs a number. I assume usb temperature sensors already exist Mar 20 12:21:37 well currently there is no support for USB connection Mar 20 12:21:57 but you have android.os.IUsb Mar 20 12:22:21 it would be as mounting a media Mar 20 12:22:40 so you could try using the sdcard and use that as stub for the moment Mar 20 12:22:56 gathering the data from static file until the USB api is implemented Mar 20 12:23:17 cool thanks acsia Mar 20 12:23:40 what kind of app are you working on? Mar 20 12:24:27 http://androforge.net/gf/project/geophoto/ Mar 20 12:24:57 I am porting it to M5 and I am doing a pluggable framework for geo located data Mar 20 12:25:11 oh no way, that's you, oh no wonder it didn't work for me Mar 20 12:25:13 I am been kicking my head as I am trying to use reflection Mar 20 12:25:24 i downloaded that, and it didn't work, i use sdk 5 though Mar 20 12:25:49 yes I wanted to finish it up on M3, then I began another project and now I am porting it to M5 Mar 20 12:25:54 I ll update the site Mar 20 12:25:59 acsia, it seems like you have a better idea about how the camera works than I do Mar 20 12:26:23 well it does not work that well, I had some issues with windows which is very strange Mar 20 12:26:26 i'd like to see it, I guess I could download m3 to give it a try Mar 20 12:26:32 but I use the camerapreview example Mar 20 12:26:33 windows? Mar 20 12:26:50 well if i run the emulator on windows it behaves differently then on linux Mar 20 12:26:59 i didn't understand how you take pictures from the camera preview Mar 20 12:27:02 oh weird Mar 20 12:27:03 which it should definitely not as it is qemu Mar 20 12:27:13 i would trust linux Mar 20 12:27:31 well you have to stop the surface view and basically use a canvas instead of surface to catch the image Mar 20 12:27:42 i wonder, are we going to get any feedback from google about making sure they could run our app correctly? Mar 20 12:27:58 and then where do you save the image? Mar 20 12:28:04 there is no photo gallery app yet? Mar 20 12:28:15 you can check http://www.anddev.org/using_camerapreview_to_save_a_picture_on_disk-t226.html Mar 20 12:28:35 photo gallery - not really Mar 20 12:28:48 I want a camera application Mar 20 12:28:56 currently the media package is broken for images Mar 20 12:29:16 so I created my own content but I rather use an external camera app and the media package for the images Mar 20 12:31:27 acsia, that solution is for M3? Mar 20 12:33:10 yes Mar 20 12:33:16 but it should be similar for M5 Mar 20 12:34:36 I ll post the release for M5 before monday hopefully Mar 20 16:07:47 I'm using a TextView inside a ScrollView and it works fine unless I use autoLink="all" on the TextView... Mar 20 16:08:07 then it allows scrolling to the left even though there's nothing out there Mar 20 16:08:37 wonder if there's a way to force horizontal scroll disabled Mar 20 19:44:15 Verizon won 700 Mhz C-block Mar 20 19:44:47 google was just bidding to up the price Mar 20 19:57:11 you know this for sure? Mar 20 20:01:30 what would be the point to up the price? Mar 20 20:03:01 romainguy: to make sure the reserve was met Mar 20 20:03:16 if the reserve is met the winner must open the network to any device Mar 20 20:03:37 ah ok I didn't know there was a condition to that part Mar 20 20:03:45 as an aside, with all this talk of "openness", where is the official definition of "open"? Mar 20 20:04:53 does it simply mean that Verizon will not actively enforce domination of the spectrum? Or does it mean that they will freely disclose all relevant technical details of how the network operates? Mar 20 20:05:08 no nothing close to either of those Mar 20 20:05:22 they will not dictate what devices you use to utilize the service they provide Mar 20 20:05:40 but if they do not disclose the details of the service they provide, what good does that do? Mar 20 20:06:02 well nothing really Mar 20 20:06:15 also, if there is no contract (implied or otherwise) between manufacturers and the carrier, how will we ensure that the network operator won't simply change their specs slightly or obfuscate heavily? Mar 20 20:06:57 I don't know that there is any guarentee on that... Mar 20 20:07:01 i mean, isn't that like saying Microsoft's SMB protocol is "open", since anyone could wiresniff it, reverse engineer, and release a compatible implementation as Samba has done? Mar 20 20:07:14 I don't think any sensible person would say that satisfies the definition of open. Mar 20 20:07:47 FCC != sensible person Mar 20 20:07:59 The FCC didn't come up with the openness clause, though. Google did. Mar 20 20:08:11 FCC.containst(sensible person) == false Mar 20 20:08:16 contains Mar 20 20:08:58 i really hate natural expression through pseudo code and related mathematical gibberish. :) Mar 20 20:09:05 haha Mar 20 20:10:27 I'm trying to find their definition of openess Mar 20 20:11:15 really though, it bothers me a lot :) Mar 20 20:11:37 anyway, i'm very curious to see what all this openness is really about. Mar 20 20:12:11 if (conversant.equals(Conversant.JASTA)) { throw new DoNotUseCodeException(); } Mar 20 20:12:12 my suspicion is that it will require full disclosure of technical details sufficient to develop and use a compatible device Mar 20 20:12:30 morrildl: that != funny Mar 20 20:12:38 hehe Mar 20 20:12:38 * jasta shoots morrildl for making him do that Mar 20 20:12:43 hahahahahahaha Mar 20 20:12:52 I WIN AT IRC Mar 20 20:13:14 U HAS SKILLZ Mar 20 20:13:18 ;) Mar 20 20:14:18 jasta: http://arstechnica.com/news.ars/post/20070731-fcc-sets-700mhz-auction-rules-limited-open-access-no-wholesale-requirement.html Mar 20 20:15:04 ha Mar 20 20:22:00 from engadget "the most noticeable change in the way telcos normally do business. With that clause in place, we'll likely start to see a market of carrier-free phones and devices -- gadgets made to work in harmony with the 700MHz band, but not locked into a service provider like AT&T. The iPhone couldn't exist in a 700MHz world -- it would have to be transportable to other carriers." Mar 20 20:22:20 that doesn't sound right to me though Mar 20 20:25:30 huh Mar 20 20:25:37 someone should tell that guy about unlocked GSM phones Mar 20 20:44:35 would you know if an application has its own uid in the system? Mar 20 20:45:24 it does Mar 20 20:46:24 ApplicationInfo will give the uid and gid but do I have a system id? Mar 20 20:46:35 whats the system id? Mar 20 20:47:23 well gid would be the goup id which can be shared, similarly the user id Mar 20 20:47:37 i know what uid and gid are. Mar 20 20:47:56 I need a unique id Mar 20 20:48:15 I would presume you would Mar 20 20:48:43 both gid and uid can be shared accross applications Mar 20 20:48:54 what would i use to have a unique id for my app Mar 20 20:49:02 why would you want to ensure that? Mar 20 20:50:02 well I am playing around with package manager and I want to save the installed application in the DB Mar 20 20:50:33 I could use a string for its package name but was wondering if there wasn't a unique id for each application Mar 20 20:50:50 for an update manager Mar 20 20:55:36 anybody around with experience on using the SDK with bluez? Mar 20 21:03:21 i get that error: E/org.bluez.*( 693): D-Bus error: The name org.bluez was not provided by any .service files Mar 20 21:03:40 but i have a bluetooth.services file for org.bluez (ubuntu 0710 default) Mar 20 21:22:22 I have the same issue hari but did not really look into it Mar 20 21:22:27 same os Mar 20 22:22:11 <_avatar> is there a way to tell a TextView automatically ellipsize its text if necessary? i don't see anything in the docs, but perhaps i'm completely missing it Mar 20 22:22:37 ellipsize? Mar 20 22:22:56 in the next SDK :) Mar 20 22:23:34 hehe, tired of that phrase Mar 20 22:23:52 stop complaining :) Mar 20 22:24:45 yeah yeah yeah...just upset at MediaPlayer right now Mar 20 22:25:23 <_avatar> whats wrong with ellipsize? :P Mar 20 22:25:32 <_avatar> oh tired of the phrase "in the next SDK?" :) Mar 20 22:25:44 <_avatar> and yeah, i'm also frustrated with the MediaPlayer Mar 20 22:26:12 <_avatar> did you ever try MediaPlayer.create, zhobbs? it didn't work for me Mar 20 22:26:33 No, lemme try that now Mar 20 22:27:10 sigh, my app crashed while i was trying to debug it Mar 20 22:27:13 seg fault :\ Mar 20 22:29:26 uhm, just crashed again in the exact same place Mar 20 22:29:55 <_avatar> btw, speaking of the next SDK, are there any release date rumors? Mar 20 22:30:08 <_avatar> wow, a seg fault? Mar 20 22:30:15 I would guess after the 14th Mar 20 22:31:21 <_avatar> hrm, ok Mar 20 22:32:28 hmm, this is reproducible. Mar 20 22:39:43 http://code.google.com/p/android/issues/detail?id=501 -- for anyone that's curious :) Mar 20 22:49:53 this is really frustrating, i actually need to debug this code :) Mar 20 23:30:14 jasta: you're working on a media player right? Mar 20 23:30:26 yeah, in a sense Mar 20 23:30:44 so are you going to put the MediaPlayer object in a service? Mar 20 23:31:00 yes, i was planning to. Mar 20 23:31:26 are you going to have a ProgressBar to show the song's progress? Mar 20 23:31:44 i would like to, yes. Mar 20 23:32:03 I'm just wondering if you'll be polling the service or have a local timer and just be notified of sometime happening? Mar 20 23:32:23 i will probably optimize it with a local timer. Mar 20 23:32:30 I have a question about software business models. Google says that we maintain full distribution rights for our application Mar 20 23:32:54 jasta: yeah, polling the service seems like a bad idea... Mar 20 23:33:03 would it be possible/make sense to have apps auto-update, or have 30 day trials, and require activation, etc.? Mar 20 23:33:09 though the opnebinder is said to be very efficient. Mar 20 23:33:19 i know with the iphone, you can distribute your app through itunes Mar 20 23:33:22 zhobbs: well, you would never poll the service. in this case, you'd have the service alert you through an observer. Mar 20 23:33:33 polling the server would be silly since you'd already take on the overhead of a local timer anyway! :) Mar 20 23:33:53 jasta: well I'm currently not using a timer Mar 20 23:34:17 just asking the service for the progress twice a second Mar 20 23:34:32 uhh, that's a timer :) Mar 20 23:35:18 rhett: you can do whatever you want as far as distribution/activation Mar 20 23:39:07 there's a cheap gas finder for the hacked iphone Mar 20 23:39:39 that's a pretty simple app though, but useful Mar 20 23:39:53 i wonder if I want my gphone cluttered with stuff like that Mar 20 23:40:23 i do :) Mar 20 23:42:00 well that's kind of the nice thing about he web, you don't have to install all that crap on your computer Mar 20 23:42:56 yeah, but that's the bad thing about the web: it is a miserable experience on slow, weak devices. Mar 20 23:47:51 <_avatar> i've just started looking at services; in the conversation a few minutes ago you guys talked about using a service to alert you through an observer. how is this accomplished? i didn't think you could pass object references between activities? Mar 20 23:48:10 _avatar: you can pass parcelables Mar 20 23:48:22 he was talking about having listeners Mar 20 23:48:30 for async service communication Mar 20 23:49:12 _avatar: you can pass a reference to a binder, which is a particular type of object used for communication. that is how you implement asynchronous communication in the way that we discussed. Mar 20 23:49:22 it is very easy to do, and the RemoteService example in the latest SDK demonstrates it. Mar 20 23:49:31 <_avatar> awesome, thanks Mar 20 23:49:38 <_avatar> that should save me some time digging around :) Mar 21 00:00:13 why not just use broadcast intents for async? Mar 21 00:00:46 because then you could not control which binder end-point is woken up for certain events. Mar 21 00:01:41 which, if any. Mar 21 00:02:13 i just have a common IntentReceiver that i plug in to any Activity that needs to listen to events, i think it works Mar 21 00:02:27 yes, of course it works. Mar 21 00:02:52 it's also very inefficient depending on the nature of the events being received. Mar 21 00:03:40 there should be a very lightweight message bus for android Mar 21 00:03:51 there is Mar 21 00:04:11 it's called OpenBinder, it's implemented in the Linux kernel, and it's used for all Android IPC, including your broadcast intents. Mar 21 00:04:54 that is what i meant earlier by "which binder end-point" Mar 21 00:05:16 if you broadcast an intent, all registered receivers will have to wake up, receive the message from the bus, and possibly act on it, or possibly ignore it. Mar 21 00:05:39 if, instead, you implement a service with listeners, only those endpoints actually registered to listen for events will be woken up for them. Mar 21 00:05:40 you can set which activity receives which intent in your manifest, right? Mar 21 00:06:05 Yes, but you can't set which activity receives which intent *WHEN*. Mar 21 00:06:29 you can if you register them on the fly Mar 21 00:06:33 your design may need to evolve to the point that there is a general class of events that happen, but different parts of your application are interested in specifically different events. Mar 21 00:06:42 as in, which order? Mar 21 00:07:16 f00f-: No, as in, based on the data contained in the event. Mar 21 00:07:51 For example, let's imagine you had a service that managed downloading files for you. It could operate entirely in the background, but an activity could pop in and "check up on" all downloads, certain downloads, etc. Mar 21 00:08:16 When using async service interface every now and then I don't get the event when called and I get "ERROR/JavaBinder(1335): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)" Mar 21 00:08:17 Let's say you had one app that wanted to show FTP downloads, and another that shows only HTTP downloads (not useful, of course) Mar 21 00:08:54 With broadcast intents, both activities would need to be woken up for download state changes, with no run-time interface to control what they are interested in from the service. Mar 21 00:09:32 both would get it because they're both in the same package, right? Mar 21 00:09:47 Well, because they're both listening, yes. Mar 21 00:10:06 ah ok Mar 21 00:10:09 In this way, you are wasting resources by waking up an application that doesn't even care about the data it's being woken up for. Mar 21 00:10:35 Likewise, what if the activity isn't running? The intent receiver will still get constantly woken up when downloads progress, despite the user not being in a position to observe that data. Mar 21 00:11:24 Whereas if you implemented more direct, interface-driven communication, you could have much more scalable control over this type of behaviour. Plus, it's more logical, and easier to work with. Mar 21 00:12:31 true, although basically i'm just sending a few integer values across Mar 21 00:12:55 right, but i would argue to you then: what is the advantage of an intentreceiver over a service with an interface attached? Mar 21 00:13:15 nothing, just less code and thus less complexity Mar 21 00:13:24 the disavdvantages are clear, and they lock your design into a very crude relationship. Mar 21 00:13:30 what makes it less complex? Mar 21 00:13:36 so what you're saying is to use a observer Mar 21 00:14:11 yes, however i think your assertion about complexity is flawed. Mar 21 00:14:34 well i thought you need a ServiceConnection from each Activity to pass data long then? Mar 21 00:14:47 what kind of Observer are you speaking of? Mar 21 00:14:49 actually, the interface-driven architecture you get from services is far simpler to understand. the relationship much more closely matches the local semantics of program progression. Mar 21 00:15:08 whereas an intent is moved sort of magically from one program to another, not directly attached to anything meaningful. Mar 21 00:15:12 or logically associated with it. Mar 21 00:15:54 f00f-: you would need a service connection to synchronize delivery of messages to your service, but the ServiceConnection class is an extremely simple abstraction of that. Mar 21 00:16:10 the kind of observer i'm referring to is merely the observer pattern found elsewhere in OO programming. Mar 21 00:16:38 MyService obj = MyService.Stub.asInterface(binder); // or whatever, can't remember the code exactly Mar 21 00:17:04 obj.setOnSomeStupidEventListener(new OnSomeStupidEventeListener.Stub() { ... }); Mar 21 00:17:51 okay, so whew, so we're not polling here Mar 21 00:17:51 and in your activity's onStop you'd just unset your listener and call unbindService() so that the service is allowed to disentangle. Mar 21 00:18:18 f00f-: No, this is not much different than any other type of observer. This is why the interface-driven service approach is so superior. Mar 21 00:18:26 It's much more natural for the flow of both components, the service and activity. Mar 21 00:19:47 I actually don't see where you believe this is "more complex". Perhaps you have just not bothered with the idea of it? Mar 21 00:20:14 well it's just more 'code' Mar 21 00:20:15 :) Mar 21 00:20:21 things that can go wrong Mar 21 00:20:23 Hardly Mar 21 00:20:41 no i agree, but i think all of this should be implicitly enabled Mar 21 00:20:52 a lightweight message bus Mar 21 00:21:08 this.sendIntent(Activity1.class, bleh); Mar 21 00:21:11 it is implicitly enabled, why do you not believe it is? Mar 21 00:21:23 well i need to setup a service connection, etc. Mar 21 00:21:25 don't you see the obvious problem with that sort of usage? Mar 21 00:21:51 f00f-: Because it's IPC. Stop being dense. You can't just poof a process into existence out of thin air. Mar 21 00:22:24 if it's not active it shoulnd't be sent Mar 21 00:22:28 could add a boolean to that signature Mar 21 00:22:32 to control it Mar 21 00:22:45 just an idea! Mar 21 00:23:48 It's a very incomplete thought, f00f-. If you filled out all the design flaws you've ignored, you'd arrive yourself at precisely how android has implemented services. Mar 21 00:24:41 So, instead of a 1-liner, you get a robust, efficient, reliable system that is both logically well organized, easy to understand, and in no way "magical". Mar 21 00:25:34 And satisfies the requirement quite nicely of a persistent message bus across process boundaries. Mar 21 00:26:08 i guess you're right. i'm underthinking it a bit. Mar 21 00:26:31 you're also hassling over what, 40 lines of code? Mar 21 00:26:51 and how that is such a great burden to you that you have no choice but to ignore it Mar 21 00:27:16 well besides it being a copy and paste operation if you have many activities, there's nothing else :) Mar 21 00:27:46 hardly, most of the implementation headache is contained neatly in the service itself. Mar 21 00:27:51 not in the activities that use it. Mar 21 00:28:44 i am telling you this as someone who has extensively leveraged a robust service-oriented system atop android. android has done this part unimaginably well, especially by contrast to every other mobile platform i've seen. Mar 21 00:29:19 other mobile platforms have barely done it Mar 21 00:29:47 oh no, they have tried. they've just done it very poorly, and with little regard for efficiency. Mar 21 00:32:49 now, with all my praise, i am ready to smash android on the street as a result of this fucking debugger problem i've just encountered Mar 21 00:33:10 LOL Mar 21 00:33:27 i *need* to debug this code, and everytime i try, the process fucking segfaults. Mar 21 00:33:46 i can't really even printf debug it. it's in a separately distributed jar file independent of android. Mar 21 00:34:46 the debugger lets me attach and walk around, but if i attempt to display any local variables, it crashes the process instantly Mar 21 00:36:08 _avatar: were you polling your MediaPlayer with getCurrentPosition() or anything? Mar 21 00:38:22 _avatar: I'm thinking that getCurrentPosition() during a prepare() crashes app...not sure though, but I put a isPlaying() check in before getCurrentPosition and I'm getting better stabilty Mar 21 00:38:36 <_avatar> nope, wasn't calling getCurrentPosition() Mar 21 00:39:14 yeah, could just be one of those times where it's working and I can't get it to crash Mar 21 00:40:14 <_avatar> hmm, let me know if that solves the problem. my bug may be caused by creating more than one instance of the MediaPlayer... you said you recycle a single instance, right? Mar 21 00:40:23 yeah Mar 21 00:40:32 just .reset() and then set new data source Mar 21 00:40:55 <_avatar> perhaps I should give that a shot Mar 21 00:41:06 hasn't crashed in a while after I added that check...so that may have been my problem Mar 21 00:43:03 <_avatar> do you ever call .release()? Mar 21 00:43:33 in onDestroy() Mar 21 00:44:38 <_avatar> ok, thanks. wondering if you were calling it before reset() Mar 21 00:54:00 <_avatar> zhobbs: recycling a single MediaPlayer instance seems to solve the hard crashing, but MediaPlayer.setDataSource() still throws IOExceptions sometimes. so a step in the right direction, at least Mar 21 01:04:36 _avatar: yeah, I got a random IOException a little while ago...has only happened once for me Mar 21 01:05:07 <_avatar> are you playing local files or streaming them over http? Mar 21 01:06:52 local Mar 21 01:07:55 <_avatar> hrm. do you have an OnErrorListener? sometimes mine is called with what=1, extra=0 Mar 21 01:08:08 <_avatar> just wondering if you've ever seen that Mar 21 01:08:14 no, haven't been using OnErrorListener Mar 21 01:09:02 <_avatar> k Mar 21 01:12:01 _avatar: it means UNKNOWN error :) Mar 21 01:12:15 thats what "what=1" is defined as. Mar 21 01:12:43 <_avatar> ah, ok. thanks. :) Mar 21 01:12:53 so now you can fix it Mar 21 01:12:59 <_avatar> haha Mar 21 01:15:11 <_avatar> i guess now would be a good time to learn more about services, and just hope MediaPlayer is fixed soon Mar 21 01:55:57 how do I call a method in one activity from another activity? Mar 21 01:56:31 I'm not sure how to get a reference to the previous activity after calling startSubActivity() Mar 21 02:00:29 hmm, getParent() ... imagine that :P Mar 21 02:38:28 hmm, I don't think getParent() works in this context **** ENDING LOGGING AT Fri Mar 21 02:59:56 2008