**** BEGIN LOGGING AT Mon Jun 08 02:59:57 2009 Jun 08 03:00:03 lets skip 2 and go with ver 3 Jun 08 03:00:59 screw it; 5.0. Jun 08 03:01:16 ( http://www.theonion.com/content/node/33930 ) Jun 08 03:01:41 android 2001 Jun 08 03:02:21 and the release notes are: .... sory dave Jun 08 03:05:30 so heres a question with probably a quick answer Jun 08 03:05:35 Four. Jun 08 03:05:42 just stick with cakes and forget the bloody version numbers Jun 08 03:05:44 how do you access your main context of a running application from a BroadcastReceiver.onReceive Jun 08 03:06:17 it's a parameter to onReceive() isn't it? Jun 08 03:06:36 but you need to be very careful Jun 08 03:06:46 is this a manifest receiver, or a registered receiver? Jun 08 03:07:05 (that is, a receiver declared via a tag in your manifest, or a receiver registered at runtime?) Jun 08 03:07:05 manifest Jun 08 03:07:11 okay Jun 08 03:07:20 when the receiver is run, your app may not be running at all. Jun 08 03:07:43 should I use registerreceiver? Jun 08 03:07:53 hm actually it looks like im getting an error Jun 08 03:07:58 when I try to cast the context to the class Jun 08 03:08:21 right Jun 08 03:08:37 i'm checking the code here, hang on a sec Jun 08 03:08:42 damn it, when am I going to be able to buy an ion? Jun 08 03:08:44 * KNY sighs Jun 08 03:08:45 :) Jun 08 03:10:22 public void onReceive(Context context, Intent intent) { Jun 08 03:10:23 IrcWindow ircwindow = (IrcWindow) context; Jun 08 03:10:35 nyt, yay, are you making an IRC client? Jun 08 03:10:43 i wrote android irc Jun 08 03:10:54 just working on some stuff for it Jun 08 03:10:56 nyt, the one in the market? Jun 08 03:10:58 yes Jun 08 03:11:10 is it worth $5? (I know, a *whole* $5!) Jun 08 03:11:14 yep Jun 08 03:11:31 I've been pondering getting it but I don't really IRC from my phone (since it would consume my life) Jun 08 03:11:43 I assume it does, but can you confirm that it works with a BNC? Jun 08 03:11:48 yep Jun 08 03:11:56 i use it with znc constantly Jun 08 03:12:02 lovely, i just checked the feedback Jun 08 03:12:04 i have a heap of idiots commenting Jun 08 03:12:07 sBNC is my BNC of choice Jun 08 03:12:13 mainly because there is an ubuntu package haha Jun 08 03:12:18 nyt: wait, what is an IrcWindow? Jun 08 03:12:41 the main activity Jun 08 03:12:52 public class IrcWindow extends Activity { Jun 08 03:12:56 broadcast receivers are passed your *application* context Jun 08 03:13:05 not an activity's context Jun 08 03:13:09 hm Jun 08 03:13:13 kj Jun 08 03:13:14 k Jun 08 03:13:32 like i said, none of your activities are necessarily running when onReceive() is called Jun 08 03:14:13 yeah if its not running i just want to throw out the event that was received Jun 08 03:14:24 but if it is running, i want to access the context it was run from Jun 08 03:14:52 you can't Jun 08 03:15:00 that is not the context it's given Jun 08 03:15:32 broadcast receivers are not part of the activity lifecycle; they are not tied to it Jun 08 03:15:58 I'm looking for some kind of reliable way to send keepalives every X seconds Jun 08 03:16:02 nyt: what youre looking for is a way to dynamically register the receiver. Jun 08 03:16:04 handler doesnt run when device is in deep sleep Jun 08 03:16:18 setsotimeout and everything else tied to uptimemillis doesnt either Jun 08 03:16:24 when the activity is showing and between onstart and onpause or stop, register the receiver Jun 08 03:16:28 when stopped or paused, unregister. Jun 08 03:16:41 you want a service Jun 08 03:16:43 ... Jun 08 03:16:44 that is, a Service Jun 08 03:16:46 this is in a service Jun 08 03:16:46 construct the receiver with a reference to the activity context that is interested and this is how you can connect this Jun 08 03:16:53 like i said Jun 08 03:17:08 oh, well it doesnt change my suggestion. replace activity with service. Jun 08 03:17:17 you want to dynamically register and unregister the receiver. Jun 08 03:17:18 when the device is in deep sleep, setsotimeout, thread.sleep, handler, and anything else tied to uptimemillis do not run when the device is in deep sleep Jun 08 03:17:31 nyt: here... Jun 08 03:17:33 this is in a service Jun 08 03:17:35 ==jasta -- don't use a manifest receiver; register it at runtime in your service Jun 08 03:17:50 http://devtcg.blogspot.com/2009/01/push-services-implementing-persistent.html Jun 08 03:17:50 so registering it in the service will tie it to the context of the activity Jun 08 03:17:53 download the source code for that. Jun 08 03:17:55 ? Jun 08 03:18:00 it's probably exactly what youre looking for Jun 08 03:18:29 also, alarms work even when the device is asleep Jun 08 03:18:32 i use an alarm manager for keep alives. Jun 08 03:18:44 yes, i know they work when the device is asleep, hence why I'm using them Jun 08 03:18:51 ok Jun 08 03:18:52 in fact, this is a complete working example of how to implement persistent connections. Jun 08 03:19:02 so registering them with registerReceiver will tie it to the activity and not the application right? Jun 08 03:19:19 I already have the code, I just need to trigger the event handler I wrote in the right context Jun 08 03:19:45 ill use registerreceiver Jun 08 03:19:47 see how it does Jun 08 03:19:57 nyt: it is always triggered in the application context, but you can connect it to your lifecycle by using registerreceiver and unregisterreceiver. Jun 08 03:20:03 android isn't responsible for this. Jun 08 03:20:05 you are. Jun 08 03:20:34 yes, just didnt realize it was starting it from teh application and not the activity unless it was done with registerreceiver Jun 08 03:20:46 that is, registerReceiver(new MyReceiver(MyService.this), ...); -- constructing MyReceiver with the services context Jun 08 03:20:52 now youre responsible for managing those references to prevent leaks Jun 08 03:21:14 nyt: registerReceiver() is a method called directly on a Context Jun 08 03:21:15 if you forgot to unregister receiver, for instance, you'd leak the service indefinitely and you'd likely break your application logic quite severely Jun 08 03:21:20 that's the difference Jun 08 03:21:31 whereas is part of an Jun 08 03:22:23 got it Jun 08 03:22:27 ctate: actually thats not the reason its different. Jun 08 03:22:38 registerreceiver from activity or services still just calls applicationcontext#registerreceiver Jun 08 03:22:46 jasta: that conveys the scope and ownership succinctly, though :) Jun 08 03:22:57 the reason its different is because you have taken over management of the lifecycle of the broadcast, and have yourself ensured that it is attached to your activity or service lifecycle Jun 08 03:23:04 but if you fail to manage that relationship correctly, you will break it. Jun 08 03:23:10 setting it as a receiver in the manifest just tells it what class to run, registering the receiver does it with an actual instantiated object, problem solved Jun 08 03:23:38 if you want to see the problem incorreclty in order to move on, fine. but that isn't true. Jun 08 03:24:11 ha ha Jun 08 03:24:16 * _avatar also wrestled with this keepalive problem Jun 08 03:24:21 how is that not true? setting it as a receiver in teh manifest will run the class unrelated to any activities running, as opposed to registering the receiver will run the actual broadcastreceiver you pass it? Jun 08 03:24:41 <_avatar> oops, we've changed topics slightly. i was scrolled up a couple pages Jun 08 03:24:43 <_avatar> don't mind me Jun 08 03:25:05 nyt: the manifest will instantiate the class using reflection, whereas you are instantiating it in your own code. the functionality of that object has not changed. Jun 08 03:25:09 okay, yeah, registered receivers still just tell the OS "hey call this on my app's main thread when the time comes" Jun 08 03:25:20 you could, for instance, register the receiver in the manifest and dynamically connect it to multiple activities in your application Jun 08 03:25:31 but that main thread will be the one configured for your activity as long as your activity is running Jun 08 03:25:35 so there you go Jun 08 03:26:11 ctate: the main thread is the same regardless. Jun 08 03:26:45 but the lifecycle stuff that has happened on it is not Jun 08 03:27:00 the issue is how the broadcast receiver is managing references to a specific set of activities or services. the easy way is to manage that yourself with an inner class and register/unregisterreceiver at the correct moment Jun 08 03:27:13 there are more sophisticated ways which could still allow the broadcast receiver to be defined in the manifest Jun 08 03:27:14 so e.g. a manifest receiver will get your application class (if any) but none of your activities' oncreate() methods are guaranteed to have run etc Jun 08 03:27:19 and in fact, Google has taken advantage of this for some apps Jun 08 03:27:19 as you said earlier :) Jun 08 03:27:48 (there are also some broadcasts that are sent *only* to registered receivers, fwiw) Jun 08 03:27:58 i.e. only to already-running apps & services Jun 08 03:28:20 ctate: yes, and so the correct way to visualize the problem is that you must guarantee that the broadcast receiver is being called within an activity or service lifecycle, and that it has the appropriate references to those components when it does run. Jun 08 03:28:59 again, the easy way is with an inner class and register/unregisterreceiver at the right moment. but it is false to say that because registerReceiver is called with an activity or service context that it has solved the problem. Jun 08 03:29:01 "has the appropriate references" meaning, if it's an inner class, that the ParentClass.this pointer is valid & useful, etc. Jun 08 03:29:16 ctate: yes, exactly. but if its not an inner class, there are other ways to do this. Jun 08 03:29:21 sure Jun 08 03:29:48 for instance if you had an app like the home screen which may or may not be running but must always react in some way to a wallpaper change broadcast event Jun 08 03:30:12 if the activity is up, it must update the displayed views. if not, it must store the bitmap and update the views when it comes back. Jun 08 03:30:35 so this receiver could be defined in the manifest, and it is, but coudl still participate in the activity lifecycle when relevant Jun 08 03:30:50 the way you described this problem made this particular usage seem impossible. Jun 08 03:31:36 wmealing: json was slow.... ~9 seconds. Java ser acceptable= .9 seconds. (300k json = 2.5k serialized!) Jun 08 03:31:46 or actually i think its defined statically, but this is only to lazy load. Jun 08 03:31:57 hunterp, its good that you benchmarked and compared. :) Jun 08 03:32:50 wooot. :-) Jun 08 03:33:12 hm, when I register the alarm receiver with registerreceiver, I'm not seeing it run =[ Jun 08 03:33:29 nyt: alarms dont get fired by a broadcast event to my knowledge Jun 08 03:33:35 you must use AlarmManager Jun 08 03:33:55 I'm using alarm manager Jun 08 03:34:05 the events were getting picked up before when i had the receiver in the manifest Jun 08 03:34:14 but I removed it and I'm using registerReceiver now Jun 08 03:34:39 does it need to be in the manifest and get registered? Jun 08 03:35:15 i'm not sure how exactly youre using alarmmanager, but i dont believe it is going to send broadcasts ever Jun 08 03:35:31 you pass it an intent, which it fires. see my testkeepalive example for usage. Jun 08 03:37:45 let me compare code and see what I'm doing different Jun 08 03:37:51 I'm using alarmmanager.set Jun 08 03:41:47 so you pass it the context where you have a broadcastreceiver registered Jun 08 03:41:54 thats what I'm doing, but its not running for some reason Jun 08 03:42:09 <_avatar> i use a BroadcastReceiver with my alarm without problems, so it's possible Jun 08 03:42:20 yeah im missing something, ill figure it out Jun 08 03:42:24 havent slept in too long Jun 08 03:42:28 oh PendingIntent.getBroadcast, yes Jun 08 03:42:45 im just abusing the services onstart intent to communicate from the alarm. Jun 08 03:42:56 onStart is very poorly named in a service. it should be called onReceiveIntent Jun 08 03:43:07 with onStart pulled out separately and joined more closely with onCreate Jun 08 03:43:13 but that cant happen no so oh well :) Jun 08 03:43:14 now* Jun 08 03:44:01 <_avatar> i seem to remember having problems with my broadcast receiver not being called when i was messing with this. i can't remember what it was tho Jun 08 03:45:08 <_avatar> i can't find anything in my code that suggests a struggle though, i must have been doing something stupid :) Jun 08 03:46:30 i dont see any advantage to use a broadcast receiver for this though Jun 08 03:46:37 you can more easily communicate back through onstart in a service... Jun 08 03:46:49 but whateve r:) Jun 08 03:48:42 <_avatar> i don't see a disadvantage to using a broadcast receiver, it seems more semantically correct given the (perhaps misleading) name of onStart :0 Jun 08 03:48:53 <_avatar> er :) Jun 08 03:49:04 well, the disadvantage is that you have to manage register and unregister. Jun 08 03:49:45 so basically you have to wrap all calls to alarmmanager.set and cancel Jun 08 03:49:57 but this is a very minor point :) Jun 08 04:01:21 public class AlarmReceiver extends BroadcastReceiver Jun 08 04:01:21 ircwindow.registerReceiver(alarmReceiver, new IntentFilter("TEST123")); Jun 08 04:01:21 Intent intent = new Intent(sc.ircwindow, AlarmReceiver.class); Jun 08 04:01:21 intent.setAction("TEST123"); Jun 08 04:01:21 PendingIntent pendingIntent = PendingIntent.getBroadcast(sc.ircwindow, 0, intent, 0); Jun 08 04:01:22 sc.alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 5000, pendingIntent); Jun 08 04:01:26 so, whats wrong there Jun 08 04:02:27 AlarmReceiver.onReceive never runs Jun 08 04:05:59 ? Jun 08 04:06:31 <_avatar> where are you registering the receiver? also, I don't create my Intent instance with a context or class, just an action Jun 08 04:06:39 <_avatar> Intent intent = new Intent(ACTION_CHECK_CONNECTION_STATE); Jun 08 04:06:40 <_avatar> PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); Jun 08 04:06:57 I'll try that Jun 08 04:07:17 registering the receiver in the main activity Jun 08 04:07:36 which is the same context im passing to pendingintent.getbroadcast Jun 08 04:07:40 <_avatar> actually, come to think of it, this may have been where my struggling ocurred Jun 08 04:07:56 that fixed it Jun 08 04:07:57 thank you Jun 08 04:08:00 right Jun 08 04:08:05 <_avatar> np Jun 08 04:08:11 passing the context to the intent was fubaring it Jun 08 04:08:18 i was going crazy with this all day Jun 08 04:08:19 actually Jun 08 04:08:19 * nyt sighs Jun 08 04:08:27 it might have been specifying the class Jun 08 04:08:29 <_avatar> i haven't looked at the android source around this stuff, so i can't explain why your previous method doesn't work Jun 08 04:09:04 <_avatar> maybe jsharkey knows ;) Jun 08 04:09:41 did you define AlarmReceiver as a in your manifest? Jun 08 04:09:55 no Jun 08 04:10:01 its working now Jun 08 04:10:10 Intent intent = new Intent(sc.ircwindow, AlarmReceiver.class); Jun 08 04:10:15 just changed to new Intent() Jun 08 04:10:18 aha thats why Jun 08 04:10:33 setting the class sets the ComponentName explicitly Jun 08 04:10:46 instead of matching to any setAction() tag Jun 08 04:11:01 yeah i waws setting the wrong class Jun 08 04:11:41 lack of sleep is bad Jun 08 04:12:28 hm, even setting the correct class still doesnt like me Jun 08 04:12:31 whatever, will just do it without Jun 08 04:14:14 jsharkey: why does setting the class on the intent there cause it not to be received by the broadcast receiver? Jun 08 04:14:31 because it then looks for a Jun 08 04:14:38 ah Jun 08 04:14:47 <_avatar> ah Jun 08 04:14:54 i didnt see any documentation for that Jun 08 04:15:12 and I didn't want to do it through a service as that seemed hackish Jun 08 04:15:52 _avatar: you just saved me a ton of headache, thank you so much haha Jun 08 04:15:59 <_avatar> np Jun 08 04:16:27 now I have an event queue in android irc that ACTUALLY triggers events when its supposed to =] Jun 08 04:16:28 * nyt gasps Jun 08 04:16:59 <_avatar> awesome :) Jun 08 04:17:25 seems tmo was killing the sockets for inactivity, since I was relying on the server pings Jun 08 04:17:28 hopefully this will help Jun 08 04:18:12 ouch how long until they timed out? Jun 08 04:18:15 <_avatar> yeah, i had a similar problem with my app. it needs to maintain a persistent connection to the server, but my sockets were being disconnected periodically. now i wake up the client periodically and send a ping Jun 08 04:18:31 jsharkey: I'm not sure, I think the server has like 3 or 5 minute pongs Jun 08 04:18:36 pings rather Jun 08 04:18:43 so when the device was sleeping, there'd be no data for 3-5 minutes Jun 08 04:18:46 <_avatar> 300 seconds in my experience Jun 08 04:18:53 ouch, that seems really short Jun 08 04:18:56 yea Jun 08 04:19:26 it was timing out all over the place =[ Jun 08 04:19:31 worked great on wifi tho Jun 08 04:20:21 going to try 60 second pings and see how it works Jun 08 04:23:00 <_avatar> well, after wasting hours trying to figure out how to get my app to compile against the 1.5 SDK it turns out project.aidl is no longer used. Jun 08 04:23:04 <_avatar> *sigh* Jun 08 04:24:01 <_avatar> that was an easy fix. wish that change would have showed up in the release notes, or the eclipse plugin would have warned me or something Jun 08 04:24:32 <_avatar> i thought i had some sort of weird syntax error in my aidl definitions Jun 08 05:42:17 ugh Jun 08 05:42:23 now i get the fun job of writing blowfish Jun 08 05:42:26 hooray Jun 08 05:43:29 i'm fixing ipsec-tools for linux.. Jun 08 05:43:37 guess who is going to have MORE fun Jun 08 05:44:12 Hi I want to understand the Google Maps application and if I'm capable of this I want to help add walking and public transit to this app. any hints on where I could start, thanks. Jun 08 05:45:43 nyt: You're going to port blowfish to Java for Android?? Jun 08 05:46:59 unless i can find a java implementation quicker than i can port it Jun 08 05:48:06 i'm pretty sure ive seen a java implementation of blowfish Jun 08 05:48:25 Can't you link in C via JNI or something? Jun 08 05:53:14 There are plenty of Java bindings to blowfish already available. I'd be interested to see how fast a pure Java version ran on an Android phone though. Slowly, certainly, but I wonder if it could be fast enough to be useful. Jun 08 05:53:50 It's hard to say as pretty much every crypto library for a high level language is just a binding to a C/C++ implementation. Jun 08 05:54:35 wish they just had it in android =[ Jun 08 05:56:04 Android has HTTPS, doesn't it? So it must have some SSL code in there. I have no idea if blowfish was included in that, as I haven't looked at it at all. I guess that would be in the undocumented, do-not-use code anyway. Jun 08 05:57:22 ssl, just no blowfish Jun 08 05:58:02 Oh that's too bad. Any idea what ciphers they did include? Jun 08 05:58:37 getEnabledCipherSuites Jun 08 05:58:40 * nyt shrugs Jun 08 05:58:48 i'd check but im testing some other stuffs atm Jun 08 06:00:33 I was just curious. Jun 08 06:04:58 sec Jun 08 06:04:59 got the list Jun 08 06:05:00 will upload Jun 08 06:06:02 i know i could have used logcat from cmdline Jun 08 06:06:04 but im lazy Jun 08 06:06:14 http://img13.imageshack.us/img13/5223/androidcipers.png Jun 08 06:06:27 no BF Jun 08 06:06:41 Hey thanks! That's very interesting to know. Too bad about the blowfish. Jun 08 06:54:28 tmo killing my tcp connections in < 3m when idle Jun 08 06:54:30 awesome Jun 08 06:58:34 YAY TMO! Jun 08 07:05:32 hi all Jun 08 07:05:38 esses back Jun 08 07:05:42 :-) Jun 08 07:05:54 not developing question don't worry... Jun 08 07:06:37 only I need to know how to get a pdf attachment from a downloaded email with the standard email client android app Jun 08 07:06:53 because I don't know how to save it from email client Jun 08 07:07:09 no menu items about saving attachment... Jun 08 07:57:48 Anyone: hi all, can anyone help me with constructing some regex patterns ? Jun 08 07:59:54 ask-to-ask is the least useful protocol ever Jun 08 07:59:55 just ask Jun 08 07:59:59 hehe Jun 08 08:02:25 well, i want to check the contents of a string for various words e.g. "help,"control","movement" and then apply different links on each one Jun 08 08:02:51 at the moment I just have Pattern procedureMatcher = Pattern.compile("Control"); Jun 08 08:03:19 just to test the word "control", but how do I add other words ? Jun 08 08:03:52 Control|Help|Movement ? Jun 08 08:04:05 Or Jun 08 08:04:09 Do you want them to be words? Jun 08 08:04:12 (string1|string2|string3) Jun 08 08:04:14 Like, with a space before / after them? Jun 08 08:04:41 It'd be \b(Help|Control|Movement)\b then. Jun 08 08:04:59 Hi Matsy, cool, thanks a lot :) I will give it a bash. Jun 08 08:05:12 It wasn't just me :< Jun 08 08:05:18 but um Jun 08 08:05:22 and deebo, sorry missed you Jun 08 08:05:24 different links to each one? Jun 08 08:05:28 Yeah Jun 08 08:05:31 I was thinking about that too Jun 08 08:05:35 This just matches everything Jun 08 08:05:53 yes, i can use matcher to control what happens with the links ? Jun 08 08:06:01 links? Jun 08 08:06:23 just use group 1 and do a string comparison.. Jun 08 08:06:34 well for example - Control = link1 Help = link2 etc Jun 08 08:06:41 then based on the contents of the group apply the right link Jun 08 08:07:40 or if you can influence teh source, use some structured language to define it Jun 08 08:07:48 ok Thanks to all, i will have a go. Jun 08 08:07:49 so its easier to manipulate than using regexp Jun 08 08:08:30 deebo: influence the source ? sorry bit of a beginner here. Jun 08 08:09:09 I think he's pointing at the source you're parsing Jun 08 08:09:13 Like, the data. Jun 08 08:09:24 a ha Jun 08 08:10:41 Hmm. Jun 08 08:10:54 There's something wrong with my Eclipse, for sure. Jun 08 08:11:25 why whats happening ? Jun 08 08:11:30 Well Jun 08 08:11:37 First, my Eclipse bugged out completely Jun 08 08:11:45 Couldn't load any required Java classes anymore Jun 08 08:11:52 So, I figured a reinstall wouldn't be too weird Jun 08 08:12:00 And now, I can't install the Android Developer Tools anymore. Jun 08 08:12:11 Not via the distro site / archive file Jun 08 08:12:59 funnily enough, i had the same problem - didnt think it installed, just ran from a folder ? Jun 08 08:13:09 Yeah. Jun 08 08:13:35 i got round it by deleting everything relating to it and running again. Jun 08 08:14:00 there was a few folders it created. make sure they are deleted. seemed to work for me Jun 08 08:14:32 running Version: 3.4.2? Jun 08 08:15:30 hi all, does someone here know if there's a way to send multiple phone numbers/im addresses/email addresses in an ACTION_INSERT_OR_EDIT intent? Jun 08 08:16:07 Matsy: https://stonebay32.com/~globe/eclipse_after_update.png Jun 08 08:16:36 Yeah Jun 08 08:16:39 It looks like that Jun 08 08:16:43 I have no perspectives at all Jun 08 08:18:27 And somehow, it is downloading this immense list of Eclipse archives. Jun 08 08:18:39 And also the download.eclipse.org/releases/ganymede/content.jar Jun 08 08:18:52 While I'm installing it via the ADT archive, sigh :< Jun 08 08:19:06 I removed all my workspaces :( Jun 08 08:19:42 Deebo, how did you find that screenshot? Jun 08 08:20:41 its mine Jun 08 08:20:50 How did you solve it? Jun 08 08:20:56 reinstall Jun 08 08:21:03 it got completely screwed Jun 08 08:21:10 no idea how Jun 08 08:21:12 Do you know what the cause was? Jun 08 08:21:14 oh Jun 08 08:21:24 Reinstalling seems to have fixed THAT problem too Jun 08 08:21:27 i run autoupdate and suddenly eclipse looked liek that Jun 08 08:21:35 However, installing the dev tools is a major pain Jun 08 08:25:58 Or, are the Eclipse servers so slow. Jun 08 08:28:34 it seems to randomly pick mirrors in indochina or something Jun 08 08:29:01 I keep on getting Transfer Errors. Jun 08 08:37:34 Oh, the servers are bogging up Jun 08 08:46:18 Anyone: Sorry for all the questions :) how can I specify a hardcoded Long number in a method, it keeps thinking its a int ? Jun 08 08:47:12 ActivityInvokerSpan(1) - thinks its a int. but I need it to be long Jun 08 08:50:27 johnnyzen: new Long(1);? Jun 08 08:50:57 thanks duane :) Jun 08 08:51:03 ActivityInvokerSpan(1l) Jun 08 08:51:14 1d for double Jun 08 08:51:17 etc Jun 08 08:52:06 thanks deebo :_ Jun 08 08:52:08 :) Jun 08 08:55:23 I feel like a spammer here but I really need a way to send multiple IM-posts in an intent (ACTION_INSERT_OR_EDIT), or a way to send one at a time to the same receiver to give the same effect, anyone got a solution to that? Jun 08 09:24:02 Anyone: Hi all, can anyone tell me why this if statement does not work ? : if (linkMatcher.group() == "Control") { Jun 08 09:24:21 You can't compare strings with == Jun 08 09:24:37 doh! Jun 08 09:24:38 Should use .equals("Control") Jun 08 09:25:34 thanks Matsy. btw I do try to find out before I ask. been trying to work it out for ahour before asking. hope I dont do anyones head in :) Jun 08 09:26:35 every language seems to have its own bits and bobs, confusing for me. Jun 08 09:27:10 damnit, i wish i could register a receiver to a subclass of a service Jun 08 09:29:26 Hmm. Jun 08 09:29:33 Deebo Jun 08 09:29:35 Any ideas? Jun 08 09:29:50 For some reason, whenever I import my new project in the new Eclipse Jun 08 09:30:12 It fails to recognize onItemSelected(AdapterView a,View b, int c, long d) as an override Jun 08 09:32:14 Oh Jun 08 09:32:18 Fixed it by setting the compliance to 1.6 Jun 08 09:40:40 What's the name of the image Google uses for list views where a selection offers further options? It's a down-arrow used all over the place in the settings. Jun 08 09:41:15 I can't find it in the resource folder, but I did find one similar image which is much more transparent. Jun 08 09:55:37 Sigh Jun 08 09:55:41 It's screwing me over Jun 08 09:56:06 I'm going to develop on my laptop, if this error persists Jun 08 10:00:54 reinstall eclipse ;) Jun 08 10:01:55 Did Jun 08 10:01:58 Several times. Jun 08 10:02:08 But, because the Eclipse servers are currently experiencing major latency issues Jun 08 10:02:20 Installing ADT / Other plugins = a mess Jun 08 10:05:57 Matsy: are you removing .android folder etc ? when reinstalling ? Jun 08 10:06:34 The problem is not withint .android Jun 08 10:06:40 :( Jun 08 10:07:57 The problem is within one of the Eclipse internal configuration files Jun 08 10:08:08 Matsy: thats downloaded from the servers ? Jun 08 10:08:13 Yeah. Jun 08 10:08:33 Matsy: can you specify a mirror url or anthing like that ? Jun 08 10:08:41 "not really" Jun 08 10:11:05 have you tried the start from scratch approach. 1) delete everything related to eclipse. 2)Restart Router 3) Restart computer 4) Clean desk 5)Start eclipse Jun 08 10:11:22 3.5) Make a cup of tea Jun 08 10:12:30 the amount of times this has helped me in general. sounds a joke. but works :) Jun 08 10:14:31 Matsy: Trust me on this one :_ Jun 08 10:14:33 :) Jun 08 10:15:03 if it doesnt work, I will dance naked on my desk. Jun 08 10:15:21 make a photo! Jun 08 10:15:32 lol Jun 08 10:16:07 you might be able to get money out of this approach ;) Jun 08 10:16:26 i'll do it for the karma Jun 08 10:16:27 6) ??? 7) Profit Jun 08 10:16:36 yeah! Jun 08 10:17:05 * srm is off, looking for some underpants. Jun 08 10:17:21 lol Jun 08 10:18:45 well I am so pleased with myself, I have nearly finished my first app. just need to sort text out, bit of polishing and i'm done. BIG THANKS TO ALL that have helped me. :) Jun 08 10:21:06 Matsy: bill gates once told me - "If at first you dont succeed....restart your pc" Jun 08 10:24:30 Finally Jun 08 10:24:34 I fixed it. Jun 08 10:24:44 What an ANNOYING error Jun 08 10:24:56 so what happened? Jun 08 10:25:11 Some of the configuration files in Eclipse Jun 08 10:25:17 Got COMPLETELY obfuscate Jun 08 10:25:22 I dont know how Jun 08 10:25:24 Or why Jun 08 10:25:58 your solution? Jun 08 10:26:15 I still had my working development server Jun 08 10:26:19 Which had a working Eclipse Jun 08 10:26:22 With all the plugins for Android Jun 08 10:26:29 I copied that whole Eclipse folder Jun 08 10:26:37 Made some minor adjustments in the configuration files Jun 08 10:26:41 And poof, I had a working set again Jun 08 10:27:30 strange but, fine for you :) ... a pitty that johnnyzen won't get rich :) Jun 08 10:28:29 srm: don't draw too quick conclusions, this could be step 6 :P Jun 08 10:29:38 :) glad you got it working Jun 08 10:30:02 keychar: I see. Jun 08 10:38:18 is there a way to find out from inside of the app if its being developed (signed by debug key) or is properly signed and released? Jun 08 10:52:35 Hmm. Jun 08 10:52:38 Well, I was looking Jun 08 10:52:41 I might be totally off Jun 08 10:53:18 int GET_SIGNATURES PackageInfo flag: return information about the signatures included in the package. Jun 08 10:53:38 Thats in getPackageInfO() Jun 08 11:12:55 Matsy: i'm not sure if it completely solves my issue but definitely helps, thx :) Jun 08 11:13:56 What Jun 08 11:13:57 It worked? Jun 08 11:14:03 At least, for a bit? Jun 08 11:16:24 I mean at least I have a signature of my app, although I still don't know how can I use this Jun 08 11:44:20 anyone know of any file read/write tutorials for android? Jun 08 11:44:36 It's the same as in regular Java? Jun 08 11:45:04 With some exceptions ;p Jun 08 11:45:07 http://www.anddev.org/viewtopic.php?p=15101 Jun 08 11:45:11 Check that, though Jun 08 11:47:30 thanks, ill give it a try. It saves to phone memory. do I just need to type /sdcard/ etc if I want other apps to be able toa ccess the same files? Jun 08 11:50:42 Make sure you know the folder you're working in Jun 08 11:50:45 You can point other applications to that, then Jun 08 14:01:13 one last try: anyone knows of a way to send two IM-addresses in a single intent of type person? Jun 08 14:22:12 Hello Everyone :) Jun 08 14:22:33 Can anyone tell me , is it easy to port a J2ME app to Android? Jun 08 14:31:52 mib_t4bjb2yd, depends what kind of app Jun 08 14:32:19 Something like a IM say mig33 or MOrange Jun 08 14:32:25 I have ported one and I wouldn't describe it as easy Jun 08 14:32:46 So you did it manually or using some tools floating around? Jun 08 14:33:07 After googling, I found some tools. But thought of asking before using them Jun 08 14:34:15 a straight port is not hard but if you want that your app is actually usable and fits in with the rest of the apps then you need to rewrite the user interaction part (eg use standard Android widgets, take advantage of the trackball, touchscreen, app lifecycle etc..) Jun 08 14:34:49 So only UI changes Jun 08 14:34:53 Rest remains same? Jun 08 14:34:55 anybody knows of a good example on how to use openGL in android? the API samples are, in lack of another less inflamatory word, a mess Jun 08 14:35:15 I mean no changes because of a different VM. Jun 08 14:35:57 mib_t4bjb2yd, well you'd have to roll a wrapper for everything that lives under javax.microedition in J2ME Jun 08 14:36:43 if you just want to make a straight port then I would suggest http://www.microemu.org/ Jun 08 14:46:19 till now when I wanted to have some room between different widgets (say TextViews, Buttons etc..) then I wrap them separately in LinearLayouts and throw some android:padding* attributes at them.. but this sounds like Jun 08 14:46:39 ..like something ugly and green Jun 08 14:47:13 is there a better way to add space between widgets? Jun 08 14:47:46 there are many ways Jun 08 14:48:07 layout_margin(Right|Left|Top|Bottom) Jun 08 14:49:33 I want to record a demo of my android application through the emulator, any ideas of any application that can capture whats going on in a window? (using windows) Jun 08 14:53:10 Rexxars, google for ddms Jun 08 14:53:17 it wont be a movie Jun 08 14:53:21 but you can take screenshots Jun 08 14:53:30 well, I need a movie ;) but thanks Jun 08 14:54:27 zhobbs, ah right, thanks :) Jun 08 14:54:54 much cleaner now :) Jun 08 15:11:35 sammyF: you are own your own, apps-for-android has a SpriteMethodTest which might be useful if you are just getting started. http://code.google.com/p/apps-for-android/ Jun 08 15:11:56 jt436: thanks. I'll check it out Jun 08 15:12:39 I thought the spritetext sample might be helpfull, but it's referencing a lot of stuff in other classes which don't even seem to be in the same package (well .. hidden somewhere in API Samples I guess), and it's kind of very frutrating Jun 08 15:12:56 its also setup for 1.1, some things have changed in 1.5 Jun 08 15:13:02 especially as all I want to do is 2D stuff at the moment Jun 08 15:13:22 how are your game sales coming along? Jun 08 15:13:39 jt436: you REALLY don't want to know ... it might depress you :) Jun 08 15:14:08 not exact numbers but are they improving from game to game? Jun 08 15:19:31 sammyF: what are some of the games you've built? Jun 08 15:20:26 zhobbs: http://www.cyrket.com/search?q=com.sfcb Jun 08 15:20:59 zhobbs: hey btw :) Jun 08 15:21:15 hey jt436 Jun 08 15:21:33 one of these days I'm going to make a game....got to find a week where I don't work 60 hours Jun 08 15:21:43 Same here Jun 08 15:21:48 Developing a game seems like a load of fun Jun 08 15:21:57 And, you can finally get away from the constant Activity / Intent browsing Jun 08 15:22:02 And, get to game programming ;p Jun 08 15:22:07 Matsy: yep, sounds fun Jun 08 15:22:32 Mine'll be 2D, though Jun 08 15:22:32 was thinking about getting an iPod touch to see what's popular on the iphone for a good starting point :) Jun 08 15:22:37 its fun until you give the game to QA Jun 08 15:22:39 Uh. Jun 08 15:22:41 zhobbs Jun 08 15:22:45 You could always ask me? Jun 08 15:22:53 If you're only going to be using it for that Jun 08 15:22:54 zhobbs: what jt said ;) Jun 08 15:22:58 Matsy: what's popular? besides bejewled Jun 08 15:23:06 Haha Jun 08 15:23:08 Let me check, then Jun 08 15:23:30 Flight control Jun 08 15:23:38 from some aussies :) Jun 08 15:23:40 Some techno tower defence = really popular too Jun 08 15:23:56 Even I bought that Jun 08 15:23:59 I'm thinking the key to popularity for me would be online community....let the community upload replays/highscores and upload maps Jun 08 15:24:22 Yeah. Jun 08 15:25:15 have been playing some tower defense apps too...thinking it'd be cool to make the tower defense game more like a RTS Jun 08 15:25:21 (ie, they shoot at you too) Jun 08 15:25:57 The Sims is popular Jun 08 15:25:59 Flight Control Jun 08 15:26:03 only problem is, I can't create art if my life depended on it Jun 08 15:26:20 Solitaire Jun 08 15:26:25 Tetris. Jun 08 15:26:33 Oh wow Jun 08 15:26:37 And the Yetisports are on there too, now Jun 08 15:26:42 ha, that flight control game looks neat Jun 08 15:26:44 original Jun 08 15:27:00 flight control is amazing, buy it Jun 08 15:27:03 looks like an aussie wrote it "jolly good!" Jun 08 15:27:16 ha Jun 08 15:27:47 I have to find an art person though... Jun 08 15:27:59 just use some graphics from all the free spirte websites Jun 08 15:28:14 once you have some decent then find an artist to refresh it Jun 08 15:28:19 if its just for personal use you are fine Jun 08 15:28:21 jt436: I was having a hard time finding anything good, you have a link? Jun 08 15:28:44 nope, for alpha stuff i use images.google.com: grass sprite Jun 08 15:28:53 and just grab whatever looks good Jun 08 15:29:01 Ah Jun 08 15:29:02 Darn Jun 08 15:29:06 Well Jun 08 15:29:12 Do you guys know robot rage? Jun 08 15:29:17 no Jun 08 15:29:30 Like Jun 08 15:29:34 You build robots Jun 08 15:29:38 And fight with eachother Jun 08 15:29:46 And can then buy more parts, etc. Jun 08 15:29:58 Nothing like that exists yet Jun 08 15:30:19 there was some barcode fighting app, where you scan a barcode and it creates a monster for you Jun 08 15:30:25 ... Jun 08 15:30:26 What Jun 08 15:30:29 not sure what is was called on the Market Jun 08 15:30:33 That's nice Jun 08 15:40:36 I really wonder how it comes that the search engine on the market is so unreliable Jun 08 15:40:44 coming from Google after all Jun 08 15:40:54 sammyF: I noticed some client side bugs on the search Jun 08 15:41:04 improperly displaying results Jun 08 15:41:16 Someone needs to create his own Google Market Jun 08 15:42:12 Somewhat more like the apple store Jun 08 15:42:59 the Android market is slow to change/improve...but getting better Jun 08 15:43:25 True Jun 08 15:43:27 it's currently in the state it probably should have been at launch Jun 08 15:43:47 I think that applies for Android, in total Jun 08 15:43:58 yeah, maybe so Jun 08 16:04:10 anyone here has any idea Jun 08 16:04:17 On how to implement custom notifications? Jun 08 16:04:40 RemoveViews Jun 08 16:04:50 ? Jun 08 16:05:09 What Jun 08 16:05:46 there is a field of Notification called content or something Jun 08 16:05:56 Well Jun 08 16:05:58 assign it to a remote view hierarchy as with RemoteViews Jun 08 16:06:00 I need to create my own listener Jun 08 16:06:10 And then use NotificationManager to parse the notifications Jun 08 16:06:22 doesnt really work that way Jun 08 16:07:23 What Jun 08 16:07:26 Then, how does it work? Jun 08 16:07:31 Since, I'm looking at the examples Jun 08 16:07:37 And, they make this notification service too Jun 08 16:07:50 you throw up a notification which can respond to only two events: click and cancel Jun 08 16:08:00 Yeah Jun 08 16:08:07 you can produce your own custom view within that notification by using RemoteViews and the content field,but they are limited to a particular height Jun 08 16:08:14 and you may not have items like buttons that are clickable separately Jun 08 16:08:26 Nono Jun 08 16:08:28 I just need text. Jun 08 16:08:42 With Custom, I meant a custom service Jun 08 16:08:49 So, not the Android services. Jun 08 16:08:57 i fail to see the problem then Jun 08 16:09:09 The problem is within the disability of making it Jun 08 16:09:15 I'm just asking if I'm right Jun 08 16:09:29 I make a service, that service notifies NotificationManager about a notificiation Jun 08 16:09:38 Then, the application parse onIntentRecieved() Jun 08 16:09:48 And checks if the command matches? Jun 08 16:10:01 if thats how you want to design it, sure. Jun 08 16:10:07 Uh Jun 08 16:10:13 Isn't that the normal way? Jun 08 16:10:30 so you want to have multiple types of notifications which fire an intent at the same activity but with different parameters? Jun 08 16:10:50 so the activity will behave somewhat differently based on those parameters? Jun 08 16:10:51 I really only need one type of notification Jun 08 16:11:02 then why do you need to parse anything? Jun 08 16:11:19 Because I need to know what the data within it is? Jun 08 16:11:27 The data changes. Jun 08 16:11:35 Let me explain Jun 08 16:11:41 i see, so the notification contains data that the activity must respect somehow? Jun 08 16:11:43 The user recieves a notification when a new bargain is available Jun 08 16:11:58 The notification contains some information about the bargain Jun 08 16:12:00 When the user clicks Jun 08 16:12:12 The ID should be sent to the Activity that handles the notification Jun 08 16:12:17 So, the bargain shows on the screen Jun 08 16:12:32 .. is that a bit more clear? >_> Jun 08 16:12:58 yes, then i would use onIntentReceived Jun 08 16:13:28 Use putExtra for the data? Jun 08 16:13:33 yes. Jun 08 16:13:46 Okay! Jun 08 16:13:50 And now, one more question. Jun 08 16:13:53 In order for that to work Jun 08 16:14:02 The application needs to be able to retain a state of "running" Jun 08 16:14:09 Whenever the user presses the home button Jun 08 16:14:14 no it doesn't. Jun 08 16:14:19 Well Jun 08 16:14:22 For my application, it does ;p Jun 08 16:14:24 no, it doesn't. Jun 08 16:14:35 The user needs to be logged in Jun 08 16:14:40 In order to view information Jun 08 16:14:55 The authentication code is saved within the 'session' Jun 08 16:15:05 ok, then design a service which can persist login information up to some session timeout Jun 08 16:15:16 but do make sure you time out the service's life. Jun 08 16:15:23 if you run the service indefinitely the user is going to want to kill you. Jun 08 16:15:35 No one will be using this application ;p Jun 08 16:15:41 What's the easy way out?> Jun 08 16:15:55 the easy way out is the correct way: design a service which can handle all your session management Jun 08 16:16:03 Okay. Jun 08 16:16:10 And, that service should be running all the time. Jun 08 16:16:14 no. Jun 08 16:16:20 well ;p Jun 08 16:16:21 it should die with a meaningful session timeout Jun 08 16:16:25 Yes Jun 08 16:16:43 it should possibly wake up periodically to do work, but should remain dead most of the time. Jun 08 16:17:48 btw, the actual method you wer elooking for earlier is onNewIntent, and you must make sure your activity is defined correctly for it to be fired. Jun 08 16:17:56 read the javadoc for it, and also for launchMode. Jun 08 16:18:36 you probably dont want to use singleTop, but rather just let a new instance of the activity fire up, so then you'd just need to handle the intent in onCreate() Jun 08 16:18:37 Okay Jun 08 16:18:52 but thats for you to decide ultimately. Jun 08 16:20:02 afternoon guys Jun 08 16:20:14 is there anybody here who can spent a bit of time helping me with a bit of a rubbish problem Jun 08 16:22:32 Hmm Jun 08 16:22:38 Creating a service is more work than expected Jun 08 16:24:40 renegadeandy: just state your issue, someone might be able to help Jun 08 16:27:50 ok - can somebody cast their eye over my DBHandler class Jun 08 16:27:54 because it keeps crashing my app Jun 08 16:28:08 and i dont know if i am handling db stuff correctly Jun 08 16:28:47 http://pastebin.com/m232c618c Jun 08 16:29:06 oO Jun 08 16:29:07 telling us the error you get will help too Jun 08 16:29:11 for instance - everytime I make a new object of the above class - it crashes because those tables already exist, Jun 08 16:29:12 Wow Jun 08 16:29:15 thats it ^^ Jun 08 16:29:18 jasta Jun 08 16:29:21 You're a genius Jun 08 16:29:22 Thanks. Jun 08 16:29:34 It's trivial to make something like this Jun 08 16:29:41 just ran the triangleActivity sample, and on my G1, canvas beats openGL if nothing is animated Jun 08 16:29:42 oO Jun 08 16:29:43 renegadeandy: see if the tables already exist :P Jun 08 16:29:56 pretty sure that the notepad app does this Jun 08 16:30:01 well how Jun 08 16:30:03 hmm Jun 08 16:32:50 you could always (as a dirty method) wrap those two statements in try/catch Jun 08 16:34:29 Or you might want to use an SQLiteOpenHelper Jun 08 16:35:02 yea, might just do a try catch Jun 08 16:45:39 i do a couple of queries using that class Jun 08 16:45:44 and my app dies saying leak error Jun 08 16:45:50 and i dont close the DB ever Jun 08 16:45:57 are u meant to close it after every single query :S Jun 08 16:49:14 renegadeandy: you should close your cursor and your db, but it won't crash your application Jun 08 17:00:10 alright - it is crashing at the parse line Jun 08 17:00:11 http://pastebin.com/m4a87f54b Jun 08 17:00:18 SaxParseException Jun 08 17:00:32 Line just before 8 Jun 08 17:06:52 what did you put in your error handler Jun 08 17:30:20 eh Jun 08 17:44:50 I forgot how long it takes to compile Android from scratch Jun 08 17:44:55 * kRutOn falls asleep. Jun 08 18:01:54 so, when an apk gets installed, and my app receives the PACKAGE_ADDED event, is there a way to tell what actual apk file was installed? Jun 08 18:04:22 herriojr: Android doesn't care about the apk files Jun 08 18:04:26 it's all about the package name Jun 08 18:05:01 and it does give you the package name Jun 08 18:05:06 final String packageName = intent.getData().getSchemeSpecificPart(); Jun 08 18:05:09 check out Launcher's source code Jun 08 18:05:29 romainguy: ok, that wasn't listed in the documentation Jun 08 18:06:07 I need the path, so I can do cleanup of an installed apk Jun 08 18:06:26 as in not installed from the market Jun 08 18:07:37 actually, that part about the name is there Jun 08 18:07:50 I guess I read too fast Jun 08 18:08:14 thanks Jun 08 18:09:08 If I have the entire Android stack compiled and I change something in, say, frameworks/base, will a simple "mm frameworks/base" be all I need to handle the dependencies? Jun 08 18:10:58 kRutOn: I just run a make again, and it builds the dependencies, but not the entire stack from what I can tell (as in it doesn't take as long) Jun 08 18:11:31 I'm assuming that's what you're talking about Jun 08 18:11:43 yeah, pretty much Jun 08 18:14:03 from what I remember, make compares the timestamps of the .o objects (or .class in this case) to the source file timestamps to figure out what needs to be built again Jun 08 18:17:39 Yeah, I was just looking for a shortcut that doesn't take strange aeons Jun 08 18:18:02 where even death may die Jun 08 18:18:14 arr beat me to it Jun 08 18:18:23 lovecraft baiting Jun 08 18:18:40 the penguins alone could not have saved us. Jun 08 18:18:45 * kRutOn makes a Wayne's World "reeled in" motion. Jun 08 18:19:31 At night, the ice weasels come. Jun 08 18:21:02 :\ Jun 08 18:21:20 Hmm Jun 08 18:21:34 i was going to dock you for that not continuing the lovecraft flow, kRutOn, but then i decided that the penguins -> snowmobile connection was good enough :) Jun 08 18:22:19 I didn't want us to descend into Lovecraft-like depression and paranoia. Jun 08 18:23:02 This is weird Jun 08 18:23:30 Does anyone know about a sample file that shows the onActivityResult data Jun 08 18:23:33 *function Jun 08 18:23:37 in combination with Notifications? Jun 08 18:23:53 erm? not quite sure what info you're after Jun 08 18:24:24 I'm confused as to the question as well Jun 08 18:24:35 Eh. Jun 08 18:24:36 Yeah Jun 08 18:24:41 It might be a weird quesiton Jun 08 18:24:55 But, I'm looking at NotificationDisplay / NotifyingController / NotifyingService / NotifyWithText Jun 08 18:25:04 maybe explain what you're trying to accomplish Jun 08 18:25:05 And, I can't find any place where it "recieves" the data Jun 08 18:25:28 I'm trying to make my own Service to send notifications to screen Jun 08 18:25:38 And, write something up to handle the onClick of that Jun 08 18:25:53 It needs to start some Intent, whenever it's clicked Jun 08 18:26:22 so, you have a service that you want to post Notifications in the notification display? Jun 08 18:26:29 Yeah. Jun 08 18:26:39 and the application opens an activity in your application? Jun 08 18:26:50 Uh Jun 08 18:26:50 *notification opens an activity Jun 08 18:26:53 If you mean "and the notification" Jun 08 18:26:54 yeah Jun 08 18:27:01 That's what I'm trying to do Jun 08 18:27:09 when acted upon by the user, a Notification delivers the PendingIntent associated with it. Jun 08 18:27:11 so, you don't need to handle a onActivityResult Jun 08 18:27:11 that's all. Jun 08 18:27:13 the documentation on that is horrible :< Jun 08 18:27:23 Yeah Jun 08 18:27:24 what ctate said Jun 08 18:27:42 NotifyingService.java (The example) does something like this: Jun 08 18:27:43 PendingIntent contentIntent = PendingIntent.getActivity(this, 0, Jun 08 18:27:43 new Intent(this, NotifyingController.class), 0); Jun 08 18:27:51 onActivityResult() is about what happens after you call startActivityForResult() Jun 08 18:27:54 But Jun 08 18:28:04 I'm unsure what NotifyingController should contain Jun 08 18:28:07 Yeah, ;p Jun 08 18:28:12 I was wrong with that function Jun 08 18:29:51 here's some hints for figuring out what's going on, in general Jun 08 18:30:01 That's all I need, really\ Jun 08 18:30:13 your question is sort of "what is this "NotifyingController.class" thing that it's using to build an Intent? Jun 08 18:30:25 Yeah Jun 08 18:30:38 one good place to start is by using Eclipse's "show me this method" -- it's F3 on my Mac -- on the Intent constructor that's being called there Jun 08 18:30:39 It seems that NotifyingController only constist of a layout with two buttons that either start / stop the serivce Jun 08 18:30:56 when i do that, it tells me that it's calling this version: Jun 08 18:30:57 public Intent(Context packageContext, Class cls) Jun 08 18:31:07 Yeah. Jun 08 18:31:23 Oh Jun 08 18:31:26 with javadoc that says it's the way you make an Intent that is bound to one specific class Jun 08 18:31:31 I know about starting Intents and all Jun 08 18:31:31 I use that very frequently Jun 08 18:31:39 And result handling. Jun 08 18:31:52 I was just wondering why it chooses the NotifyingController class Jun 08 18:31:53 a PendingIntent is a globally-useful encapsulation of an Intent Jun 08 18:32:01 When it only has a content view Jun 08 18:32:02 with two buttons Jun 08 18:32:07 Shouldnt the class have something to handle the data? Jun 08 18:32:12 why it chooses that *name*, you mean? Jun 08 18:32:18 No. Jun 08 18:32:22 Why it chooses that certain class Jun 08 18:32:27 I'll pastebin the class Jun 08 18:32:35 NotifyingController is just another class that the sample app uses Jun 08 18:32:59 it's called "Controller" because that's what it does -- it has buttons to start and stop the notifiying service Jun 08 18:33:35 Yeah. Jun 08 18:33:38 But Jun 08 18:33:42 The service is started Jun 08 18:33:48 Before the functionality in the service could ever work Jun 08 18:33:59 Oh wait. Jun 08 18:34:27 That certain intent is started Jun 08 18:34:31 Whenever the user clicks it? Jun 08 18:34:42 that is what the notification mechanism does. Jun 08 18:34:47 I see I see Jun 08 18:34:59 it delivers the PendingIntent when the user clicks on ("acknowledges") the notification Jun 08 18:35:30 So Jun 08 18:35:34 I could add putExtra in there, right Jun 08 18:35:35 in this case, the PendingIntent encapsulates an Intent that launches the NotifyingController activity Jun 08 18:35:43 In order to recieve data Jun 08 18:35:59 Like, the certain ID of the item I'm trying to show Jun 08 18:36:00 you would put the extras into the Intent that is then put into the PendingIntent Jun 08 18:36:04 sammyF: here? =] Jun 08 18:36:05 right Jun 08 18:36:09 Yeah. Jun 08 18:36:26 PendingIntent is "hey, later on when you're needed, use this Intent here that i'm giving you" Jun 08 18:36:44 http://java.pastey.net/115584 Jun 08 18:36:46 Is there any reason Jun 08 18:36:52 To start THAT intent on the onclick, though? Jun 08 18:36:54 many reasons Jun 08 18:36:55 It makes no sense, right? Jun 08 18:37:03 No I mean Jun 08 18:37:05 that certain intent Jun 08 18:37:09 That I was pasting Jun 08 18:37:19 So, not technical-wise. Jun 08 18:37:25 this app wants to bring up the NotifyingController activity in response to that notification Jun 08 18:37:31 Yeah. Jun 08 18:37:37 But Jun 08 18:37:40 It sets a lot of data Jun 08 18:37:50 what does? Jun 08 18:37:53 .. it ends up not being used Jun 08 18:37:55 The service Jun 08 18:38:02 notification.setLatestEventInfo(this, getText(R.string.status_bar_notifications_mood_title), Jun 08 18:38:03 text, contentIntent); Jun 08 18:38:20 it does? Jun 08 18:38:30 * ctate | // Set the info for the views that show in the notification panel. Jun 08 18:38:30 OHHH Jun 08 18:38:31 I get it. Jun 08 18:38:35 is the descriptino of what that line does Jun 08 18:38:39 Never mind >_> Jun 08 18:38:43 are you not actually reading the comments? :-( Jun 08 18:38:44 Hahaha. Jun 08 18:38:48 Oh god, I am so stupid. Jun 08 18:39:17 well, i don't think the jury is in on that yet :) Jun 08 18:39:32 guilty Jun 08 18:39:42 lol Jun 08 18:40:00 kRutOn: I can give you the bash function I use to quickly build the framework Jun 08 18:40:51 Haha, thanks a lot ctate. Jun 08 18:40:53 I owe you one Jun 08 18:41:18 kRutOn: mmm frameworks/base/ frameworks/base/services/java/ frameworks/base/tests/backup/ frameworks/base/libs/utils/ frameworks/base/core/jni/ snod Jun 08 18:41:32 except you don't have tests/backup on your system probably Jun 08 18:42:07 cos you probably havent ripped the hell out of tests and have trouble with git :) Jun 08 18:42:28 Intent intent = new Intent(this,BargainSelectActivity.class); Jun 08 18:42:30 intent.putExtra("org.itopia.team.awareness.gbargain.BargainId", bargainId); Jun 08 18:42:57 Matsy: that's an Intent that will result in a specific activity being launched -- the BargainSelectActivity Jun 08 18:43:05 Yeah Jun 08 18:43:08 I wrote that up mysself Jun 08 18:43:17 and that bargainId will be visible to that activity when it looks at getIntent() Jun 08 18:43:24 and i bet that is what you wanted :) Jun 08 18:43:25 this.getIntent().getExtras(); Jun 08 18:43:29 right Jun 08 18:43:31 Would I be able to retrieve it via there? Jun 08 18:43:34 yes Jun 08 18:43:40 ^_^ Jun 08 18:43:43 I'm a happy man Jun 08 18:43:45 getIntent() gives you the Intent object, then you extract data from it as usual Jun 08 18:44:09 Can I use it in the onCreate() already? Jun 08 18:44:19 Like, has the Intent data been filled by then? Jun 08 18:44:19 of course Jun 08 18:44:23 Good, good Jun 08 18:44:37 in a sense, the Intent data predates the creation of your Activity object in the first place :) Jun 08 18:45:13 Oh. Jun 08 18:47:09 the OS looks at the intent that was passed to startActivity() Jun 08 18:47:19 figures out hey, this should start up BargainSelectActivity Jun 08 18:47:23 then goes and does that Jun 08 18:47:31 and in the process, attaches that original intent to it Jun 08 18:47:39 then says okay, off you go, and calls onCreate() Jun 08 18:47:47 I kinda get it ;o Jun 08 18:47:50 Well, I actually do Jun 08 18:47:51 http://java.pastey.net/115586 Jun 08 18:47:56 It should be something like that then! Jun 08 18:48:09 when signing an app, do i need a new key for each app? Jun 08 18:48:41 you show a new notification every 5 seconds?! Jun 08 18:48:42 eeeagh Jun 08 18:48:45 Nono Jun 08 18:48:50 Only when it exists Jun 08 18:48:53 lawl Jun 08 18:48:57 Only when a new bargain exists Jun 08 18:49:08 what could possibly go wrong Jun 08 18:49:32 okay, every 5 seconds you CHECK for a new notification Jun 08 18:49:36 Yeah. Jun 08 18:49:45 And only if there's a new one Jun 08 18:49:47 does GBargain.comm.getLatestBargain() do, like, network I/O? Jun 08 18:49:48 it'll call showNotification Jun 08 18:49:51 Yes. Jun 08 18:49:54 O_O Jun 08 18:50:01 what. Jun 08 18:50:02 teehee Jun 08 18:50:07 Look Jun 08 18:50:10 It's for school, okay <: Jun 08 18:50:15 how often do you expect it to actually change? Jun 08 18:50:16 ha ha ha Jun 08 18:50:22 Just once ;p Jun 08 18:50:25 i mean, you're basically doing constant network traffic Jun 08 18:50:27 I'm going to presenting this tomorrow. Jun 08 18:50:29 burning your battery Jun 08 18:50:30 Yeah. Jun 08 18:50:35 It's all run on an emulator. Jun 08 18:50:36 Haha Jun 08 18:50:40 if i want to do a processing icon which spins - whilst my app is doing something else - should i do it in a new thread? Jun 08 18:50:47 in the real world you'd want to check like every 15 minutes Jun 08 18:50:50 Yeah, renegadeandy Jun 08 18:50:53 or hour Jun 08 18:50:58 Haha Jun 08 18:51:02 Well Jun 08 18:51:06 I'm going to add a new bargain on the fly Jun 08 18:51:09 So, I can't say Jun 08 18:51:12 "and now we wait 15 minutes" Jun 08 18:51:14 Matsy: sure, for demo purposes Jun 08 18:51:19 Yeah ;p Jun 08 18:51:19 i'm just saying :) Jun 08 18:51:22 http://www.targetscheme.com/device.png <-- my first app Jun 08 18:51:23 I know Jun 08 18:51:24 Haha Jun 08 18:51:24 :D Jun 08 18:51:35 Matsy u got any snippets which just displays loading or something in its own lil thread? Jun 08 18:51:39 Yeah. Jun 08 18:51:40 I do ;p Jun 08 18:51:56 ewon: what's it do? Jun 08 18:52:00 ewon: oh i love the zoom on each hit point Jun 08 18:52:28 http://java.pastey.net/115587 Jun 08 18:52:31 * ctate has flashbacks to using a physical tool to resolve scoring questions on a rifle target Jun 08 18:52:32 That's the login activity I have Jun 08 18:52:45 check at the Handler code. Jun 08 18:52:49 All the way up to the Thread code. Jun 08 18:52:52 BeBoo: it's for archery, plotting of arrow impacts Jun 08 18:53:08 My code is horrible, though. Jun 08 18:53:14 First time doing Android Jun 08 18:53:23 And immediately I have to make some insane complex application Jun 08 18:53:24 ctate: was surprisingly easy to set up, it's just a View childclass that has a zoomed bitmap of the parent bitmap Jun 08 18:53:33 yeah Jun 08 18:53:39 go Android! Jun 08 18:53:54 Yeah! Jun 08 18:53:56 Other classmates Jun 08 18:53:58 Are messing with J2ME Jun 08 18:54:07 And ohh Jun 08 18:54:10 This is just so much better Jun 08 18:54:18 android java is the java that makes me want to kill myself the least. Jun 08 18:54:26 I can use annotations Jun 08 18:54:31 And, foreach loops Jun 08 18:54:31 * ewon has in the past dealt with J2EE, J2ME, and even SuperWaba Jun 08 18:54:32 <33 Jun 08 18:54:58 SuperWaba \o/ Jun 08 18:55:15 was better that setting up the native palm toolchain Jun 08 18:55:22 "Waba"? Jun 08 18:55:25 that's about the only good thing I could say about Superwaba Jun 08 18:55:38 ewon: ha ha Jun 08 18:55:43 ctate: some weird Java runtime for Palm Jun 08 18:55:49 later ported to other OSes Jun 08 18:55:53 maaan Jun 08 18:56:00 that's what I used to use to write apps on my Palm IIIe Jun 08 18:56:04 it was actually nice Jun 08 18:56:05 dear god man Jun 08 18:56:11 no wonder you're stark raving bonkers Jun 08 18:56:28 oh wait, you just wrote the apps, not the engine Jun 08 18:56:30 whew Jun 08 18:56:40 actually Jun 08 18:56:43 Oh Jun 08 18:56:46 One more question Jun 08 18:56:48 I did contribute a bit to superwaba :p Jun 08 18:56:56 I know how to define Intents in the AndroidManifest Jun 08 18:57:02 Yet. Jun 08 18:57:05 intent *filters* Jun 08 18:57:06 How does that work with Services Jun 08 18:57:13 Do I need to specify anything special? Jun 08 18:57:15 services define intent filters the same way Jun 08 18:57:26 I dont think I need intent filters. Jun 08 18:57:37 .. right Jun 08 18:57:43 hm, I'm using the emulator and on my localhost, there's an UDP_Broadcast service running. Now I want the android app receive this broadcast. Looks like it the emulator can't see the broadcast. What do you suggest to fix that? Jun 08 18:57:54 Oh Jun 08 18:58:00 I think I need to add a Service in there too, right Jun 08 18:58:04 i think you may be confused about what is in the AndroidManifest.xml file, then. the only mention of intents there is in the context of defining intent filters. Jun 08 18:58:13 Yeah Jun 08 18:58:15 Uh Jun 08 18:58:19 I was talking about Activities,. Jun 08 18:58:20 ;p Jun 08 18:58:27 if you want to publish a service, you must put a block in your manifest that describes it, yes :) Jun 08 18:58:43 romainguy: yeah, so when I add a package, I don't receive the file location for the installed package....can I only do cleanup of those files via a service that runs every so often? Jun 08 18:58:47 an Intent is just data Jun 08 18:58:47 Hi, does android.hardware.Camera allow for doing videos? Can I access a continuous stream of video frames? Jun 08 18:59:05 Yeah Jun 08 18:59:08 android:enabled Jun 08 18:59:11 Is that enabled on default? Jun 08 18:59:14 herriojr: why would you need to get th epath to the apk?? Jun 08 18:59:20 Or, shouldn't I mess with that Jun 08 19:00:27 WHAT THE Jun 08 19:00:28 IT WORKS Jun 08 19:00:38 romainguy: until we put the applications on the Market, we have have to manage our own installs for the beta users, and if we're allowing them to download them directly from the handset from our own servers, we have to manage the apk files ourselves on the device Jun 08 19:00:39 ha ha ha Jun 08 19:00:39 Are you kidding me Jun 08 19:00:45 Not even a single exception. Jun 08 19:00:53 * Matsy hugs ctate Jun 08 19:00:55 quick, check it in Jun 08 19:01:01 Check it in? Jun 08 19:01:02 ;p Jun 08 19:01:02 herriojr: that doesn't make sense Jun 08 19:01:03 you ARE using some sort of version control aren't you? Jun 08 19:01:04 Lol version control Jun 08 19:01:05 tsk tsk :) Jun 08 19:01:08 romainguy: and if they get updated often, I don't want them to overload their sdcards Jun 08 19:01:09 anyway, no you won't get the path to the apk Jun 08 19:01:09 Look Jun 08 19:01:12 The only version control I can use Jun 08 19:01:14 i always put everything in version control Jun 08 19:01:17 Is Visual Studio Team Edition Jun 08 19:01:19 personal project shit Jun 08 19:01:21 everything Jun 08 19:01:21 with temp files Jun 08 19:01:23 Or, Team Foundation Server. Jun 08 19:01:31 I'm a C# / F# programmer. Jun 08 19:01:32 >_> Jun 08 19:01:36 sigh MS tools Jun 08 19:01:42 I don't know anything about .. uh Jun 08 19:01:44 * ctate <3 Perforce Jun 08 19:01:44 How do they call it Jun 08 19:01:50 Subversion. Jun 08 19:01:52 romainguy: so, what I'm doing is downloading an apk file onto the device, then they are prompted to install Jun 08 19:01:53 * ewon uses svn for personal code, p4 for pro code Jun 08 19:01:56 svn is okay Jun 08 19:02:03 i am really used to p4 though and it's free for personal use Jun 08 19:02:08 there's no way for me to know whether they chose to install or not install it Jun 08 19:02:24 Woooo Jun 08 19:02:26 yes you can Jun 08 19:02:26 since I can't start the install activity for result Jun 08 19:02:26 I am so excited Jun 08 19:02:34 * Matsy runs around naked Jun 08 19:02:45 you can query one of your intents a bit later to see if it's installed :p Jun 08 19:02:48 or not even that Jun 08 19:02:59 just query the package manager Jun 08 19:02:59 A few more questions! Jun 08 19:03:02 haha. Jun 08 19:03:06 But Jun 08 19:03:08 I won't ask them Jun 08 19:03:11 I'll figure it out myself Jun 08 19:03:34 Well Jun 08 19:03:40 I'll ask them anyway, since there's no documentation about it Jun 08 19:03:46 the .getExtras() Jun 08 19:03:59 Is that 'null' or an empty Bundle, if no data is specified? Jun 08 19:04:20 romainguy: apk files won't have the same name as the package themselves Jun 08 19:04:33 Never mind Jun 08 19:04:43 but your app downloaded the apk so you know its name... Jun 08 19:05:01 how can I determine the package name from the apk file, I couldn't find an api for that Jun 08 19:05:28 romainguy: is the package com.google.googlenav not going to be on android any more? Jun 08 19:05:43 I hav eno idea what you're talking about Jun 08 19:05:55 me or chouman82? Jun 08 19:06:11 both Jun 08 19:06:12 it's the package for the driving direction that used to be there a while ago i think Jun 08 19:06:15 heh Jun 08 19:06:35 trying to figure out how to do driving dircetion on andorid Jun 08 19:07:06 romainguy: so the build guys have a certain way of naming apk files for easier identification (revision, etc.), so on my end, the apk file name will be different than the package name Jun 08 19:07:27 so I'm trying to cater to their needs Jun 08 19:08:15 jsharkey: ping Jun 08 19:09:59 romainguy: That would be great (re: bash function to build framework) Jun 08 19:10:25 How can I receive an UDP Broadcast with the emulator? I found the hint for disabling the IGNORE_BROADCAST in proc but I have no sufficient privileges on the emualtors terminal Jun 08 19:11:01 *emualtor Jun 08 19:11:10 *argh* e.m.u.l.a.t.o.r. Jun 08 19:12:12 Oh godd Jun 08 19:12:14 I'm so happy Jun 08 19:13:33 to put it simply, I'm trying to do: download apk to temp file, prompt user to install through Android's install Activity Intent, after install delete temp file.....when telling it to install, I just provide the url to the apk, and upon the application being installed, I have the package name (com.something.something.etc), there's no way for me to identify via the package name the apk url associated with it....does that make sense? Jun 08 19:15:42 KNY: here? Jun 08 19:17:53 herriojr: yes, I think so Jun 08 19:20:01 vol: so I'm assuming my only option is to have a service run every so often to clean up my temp files, and if they didn't install them by then, tough luck for the user Jun 08 19:20:16 they'll just have to redownload them Jun 08 19:20:35 you can always just do cleanup after the installation Jun 08 19:20:52 don't you get a broadcast when something new gets installed? Jun 08 19:21:14 I think he's saying he might have multiple installations requests in flight Jun 08 19:21:15 vol: yes, I get the package name (com.something.something.etc), but I can't identify the associated temp file Jun 08 19:21:36 kRutOn: thanks for being a translator for me ;) Jun 08 19:21:44 herriojr: You can try to use reflection to get to the PackageParser Jun 08 19:22:14 herriojr: how many temp files are going to be sitting around? and how many won't have anything to do with your app? Jun 08 19:22:21 kRutOn: Jun 08 19:22:22 you should be able to keep track internally of what goes where Jun 08 19:22:26 function fmake() { Jun 08 19:22:38 mmm frameworks/base/ frameworks/base/services/java/ frameworks/base/libs/utils/ frameworks/base/core/jni/ snod Jun 08 19:22:39 } Jun 08 19:22:41 hell, just set a variable somewhere when the installer gets run, and refer to it Jun 08 19:22:48 there's your shell function to rebuild just the framework Jun 08 19:23:27 Darn Jun 08 19:23:29 It doesnt work anymore Jun 08 19:23:34 ctate: thanks Jun 08 19:23:50 kRutOn: run it from the source tree root, obviously Jun 08 19:24:34 vol: I can keep track of what goes where, but lets say I have 3 applications which were downloaded at the same time, I can't identify which apk file is associated with what package name Jun 08 19:25:21 are you going to be installing the file via the program you're using to download them? Jun 08 19:25:39 vol: I can't, you can't ask for that permission Jun 08 19:25:47 so I have to throw an intent to the android system Jun 08 19:26:01 herriojr: Or you could parse the AndroidManifest.xml from the ZIP file if there are no other good options throught AssetManager.openXmlResourceParser Jun 08 19:26:39 kRutOn: I'll have to implement a zip parser AFAIK to do that Jun 08 19:26:44 Wow Jun 08 19:26:46 Even the persistence works Jun 08 19:27:04 herriojr: well, obviously it's already there :-) Jun 08 19:27:21 well, I'm stuck. On my local machine, I've setup an UDP Broadcast for 255.255.255.255 (java program broadcasting on socketport xxxxx). Now I want to receive this broadcast via the emulator but I jsut don't work. http://pastebin.com/m52b08745 this is the receiving method in a seperate class UDP.java. What could be wrong? Wrong broadcast adress? Jun 08 19:27:29 *just Jun 08 19:27:34 herriojr: You'd just be basically duplicating the functionality of the PackageParser class Jun 08 19:27:55 ok, I'll check that out, thanks Jun 08 19:28:43 srm: AFAIK, the emulator is connected to the host via a PPP link. PPP doesn't support UDP broadcasts Jun 08 19:29:04 *doh* will check this Jun 08 19:29:08 thanks for the hint Jun 08 19:29:25 kRutOn: fwiw PackageParser is hidden. Jun 08 19:29:50 ctate: yeah, hence the reflection suggestion (eek), but AssetManager.openXmlResourceParser is not hidden Jun 08 19:30:02 kRutOn: for some reason I thought the zip stuff was not part of the public sdk Jun 08 19:30:18 eeagh reflection. bad idea, cos then you're fragile to future changes. Jun 08 19:30:24 in general. but you knew that. Jun 08 19:30:48 I knew that but chose to ignore it as I was heading toward that concrete barrier at 120 mph Jun 08 19:31:29 srm: adb forward for tcp, what kruton said about udp? Jun 08 19:32:31 vol: said that udp broadcast will not work. Ok, then for testing purposes I'll forward the port Jun 08 19:33:13 Hmm Jun 08 19:33:14 ctate Jun 08 19:33:15 is it likely that the dev-phone will see the udp-broadcast? Jun 08 19:33:22 Any idea how the getExtras() could return -1? Jun 08 19:33:23 yes, on a wifi network Jun 08 19:33:27 *getExtras().getInt() Jun 08 19:33:29 fine :) Jun 08 19:34:39 The key I'm setting exists in the keyste Jun 08 19:34:41 keyset Jun 08 19:34:45 Yet, the value = -1 Jun 08 19:34:49 Whenever I'm setting the value as 3. Jun 08 19:35:31 Nvm, I'm stupid. Jun 08 19:35:40 Matsy: are you getting your extras from getIntent().getExtras()? Jun 08 19:35:45 Matsy: ok Jun 08 19:35:47 Yeah ;p Jun 08 19:35:48 Hah Jun 08 19:35:54 I mixed up two variable assignments Jun 08 19:37:14 Haha, this is a nice warning from adb's help: Note: you should not automatically start a PDP connection. Jun 08 19:37:24 * kRutOn forlornly powers down his PDP-11 Jun 08 19:38:41 BeBoo, pong Jun 08 19:38:51 kRutOn, haha Jun 08 19:42:02 https://review.source.android.com/10307 Jun 08 19:43:00 BeBoo: yes :P Jun 08 19:43:17 BeBoo: only one hour late, but yes ;) Jun 08 19:44:39 KNY: ping Jun 08 19:44:47 BeBoo, got your email Jun 08 19:44:52 i replied ;p Jun 08 19:45:44 so you did! Jun 08 19:45:57 sammyF: i have a new version... KNY found a bug Jun 08 19:46:00 BeBoo, http://www.cyrket.com/package/com.evancharlton.googlevoice Jun 08 19:46:17 and i increased the size of the text and spacing on the newest and near words Jun 08 19:46:35 KNY: did you also test the tap and hold on the words? Jun 08 19:46:50 KNY: very nice Jun 08 19:48:13 BeBoo: cool (especially the bug find by KNY) Jun 08 19:48:26 sammyF: you have mail Jun 08 19:48:40 oooo i forgot something Jun 08 19:48:40 I should start charging for testing services ;-) Jun 08 19:48:42 eh Jun 08 19:48:46 lol Jun 08 19:48:58 charging? free copies of software = teh win Jun 08 19:49:07 KNY: heh ... write applications everybody can use, and we'll test for you ;) Jun 08 19:49:09 i love beta testing and whatnot Jun 08 19:49:20 makes me feel importanty Jun 08 19:49:21 -y Jun 08 19:49:26 sammyF, haha Jun 08 19:49:43 sammyF, if it was up to me, everyone would have been able to use Google Voice by now Jun 08 19:49:53 chouman82: hm? Jun 08 19:50:03 KNY: yeah :/ Jun 08 19:50:18 Hmm Jun 08 19:50:27 Does anyone know how I can show a Toast message from a Service? Jun 08 19:50:45 Matsy, a notification would probably be better Jun 08 19:50:54 Well Jun 08 19:50:57 I want to use a combination of both Jun 08 19:52:30 * BeBoo doesn't even know what GV is Jun 08 19:52:31 Matsy: so, I'm assuming you want to show the toast while your application is open? Jun 08 19:52:33 * BeBoo hides Jun 08 19:52:38 Yeah. Jun 08 19:52:45 but also Jun 08 19:52:48 When the application isnt open Jun 08 19:52:48 BeBoo, http://google.com/voice Jun 08 19:53:01 Matsy: not while your application isn't open, you're not going to Jun 08 19:53:11 Uhuh Jun 08 19:53:45 Why is that? Jun 08 19:53:57 because you don't have control of the screen at that time Jun 08 19:54:10 Can't I gain control of the main screen?> Jun 08 19:54:28 kRutOn, ahahaha I just read your patch Jun 08 19:55:34 Matsy: maybe if you thrown an intent to start an activity that just shows a toast then finishes Jun 08 19:56:12 the real question is that if a lot of applications did this, how does that improve the user experience? Jun 08 19:56:24 KNY: what's it's purpose if you have a cell phone with a number? Jun 08 19:57:31 BeBoo, a) visual voicemail b) free calling (though I don't support or encourage this!) c) free SMS d) what if you have a landline, too? and a work phone? e) you can report numbers as spam so I don't care about giving out my GV number since it's not my real number Jun 08 19:57:37 Matsy: for the user's sake, I would just use a notification when your application is not open Jun 08 19:57:44 BeBoo, it's like a PO box for your phone, except better Jun 08 19:58:15 lol nice description Jun 08 19:58:29 it's not open to public yet tho Jun 08 19:58:47 Google Voice is currently available for GrandCentral users only, but will be open to new users soon. Jun 08 19:59:24 BeBoo, right, which is what sammyF is complaining about :) Jun 08 19:59:42 KNY: I wasn't complaining Jun 08 19:59:46 I was BITCHING about it :P Jun 08 20:00:02 ohhh Jun 08 20:00:15 haha Jun 08 20:00:38 actually, the part that's really messed up is that I'd REALLY like to check out your application, considering all the good comments you got, but there's no use :/ Jun 08 20:01:19 sammyF, why don't you try emailing me, asking for an invitation? hordes of other people seem to think it will work for some reason... Jun 08 20:01:22 Matsy: and in your activities that you want the toast to show, you should probably bind to your service and register a callback Jun 08 20:02:05 that way when service runs, it just notifies all listening applications/activites that are bound to it Jun 08 20:03:15 Eh Jun 08 20:03:17 :( Jun 08 20:03:21 Well, never mind about that then/ Jun 08 20:04:54 i would probably never use it Jun 08 20:05:00 i have a house phone that never gets used Jun 08 20:07:57 KNY: it would help? ;) Jun 08 20:08:18 sammyF, not in the slightest. All you'd get is my canned response :) Jun 08 20:09:00 KNY: yeah ... but is the canned response worse it? ;) Jun 08 20:09:20 sammyF, haha Jun 08 20:09:42 anyway, I think the reason why people email you is because of the way the gmail beta used to work Jun 08 20:10:13 (and of course because those people are too lazy to actually check out how it really works in this case) Jun 08 20:11:32 sammyF, well grandcentral used to work that way until they stole all their invitations back :( Jun 08 20:11:39 sammyF, and we don't have any with Google Voice Jun 08 20:15:23 oh well ... only 5 years to go until they get out of beta ;) Jun 08 20:18:18 ctate: hey you around? Jun 08 20:23:34 k4r1m: I think you just missed him, but he was around ;) Jun 08 20:23:59 herriojr: aight thx Jun 08 20:26:23 since I'm having to parse through the AndroidManifest, quick question, does anyone actually store their package name (in the manifest tag) in the strings.xml file? Jun 08 20:26:44 I know it is possible, but I want to see how smart I need to make my parser Jun 08 20:29:10 or when you "compile" the apk, are string-replacements done for all xml files which reference a string in the strings.xml file? Jun 08 20:29:28 nvm, I'll figure it out Jun 08 20:30:47 herriojr: Do you want the FQDN of the package or the appname part Jun 08 20:31:06 Hi there, any gps/network-location experts here? Jun 08 20:32:17 grrrr....even multicast is not supported on the emulator? 2 more weeks waiting till the dev-phone arrives... *damn* *rantPlaced* Jun 08 20:32:32 kRutOn: I want the package name for the app from the AndroidManifest, but as I look into it, it is "compiled", so I need to know how to convert that back Jun 08 20:32:43 srm: yes multicast is not supported Jun 08 20:33:28 i tried to impelement a upnp-client and failed due to the muticast-stuff Jun 08 20:34:57 herriojr: the com.example.whatever is in there, but not the name displayed under the icon to the user Jun 08 20:34:59 oh, brother in arms Jun 08 20:36:52 yeah, I see the com.example.whatever, I'm just look at it to figure out how to structure my parser Jun 08 20:43:34 kRutOn: do you happen to know the compiled format of the AndroidManifest.xml, or do I need to reverse-engineer it? Jun 08 20:45:04 or better yet, I'll look at the source code Jun 08 20:45:17 herriojr: I don't. I just saw that it was in UTF-16 which is no surprise. Jun 08 20:46:33 herriojr: why do you need to parse the package name?? Jun 08 20:47:17 romainguy: easy identification for removal of a temporary apk file after I receive the PACKAGE_ADDED broadcast Jun 08 20:47:35 so I can just keep a database of temp files and clean them up as they are installed Jun 08 20:48:00 romainguy: same issue as earlier ;) Jun 08 20:48:01 and why don't you know the package name? Jun 08 20:48:22 since it's your app Jun 08 20:48:24 and your apk Jun 08 20:48:26 etc. Jun 08 20:48:43 romainguy: because, more may be added in the future, and I don't want to have to update it every time one is added Jun 08 20:49:02 and can't your server give you the package name along with the apk? Jun 08 20:49:11 or just name the apk with the package name? Jun 08 20:49:36 romainguy: I'm catering to the build-release guys since they have their way of naming things based on revision, etc. Jun 08 20:49:46 ah well Jun 08 20:49:49 do your thing Jun 08 20:50:15 otherwise I would just name the apk file the same as the package :) Jun 08 20:50:17 Got another Intent question ctate :) (or anyone else) If I know a package name, what's the easiest way to launch its 'main activity'? EG, the one that fires when you double click the app? Jun 08 20:50:39 query the package manager Jun 08 20:50:42 you pass an intent Jun 08 20:50:45 give it the package name Jun 08 20:50:47 and the MAIN action Jun 08 20:51:18 hehe Jun 08 20:51:21 * kRutOn . o O ( I'll take my comments off the air ) Jun 08 20:51:38 how do you pass the package name? as the data? Jun 08 20:52:39 hmmm. streamfurious-- Jun 08 20:52:47 oh I see, the PM has methods that take a package name Jun 08 20:52:49 i sort of expect the stop button to stop downloading the stream Jun 08 20:54:31 by the way, on a tangent, are there any plans for a push service? Jun 08 20:54:50 "a push service"? Jun 08 20:55:17 ctate, like how gmail is pushed, I assume. Jun 08 20:55:25 it'd be nice to be able to push data from our own servers Jun 08 20:55:32 ctate: so, when a server wants to communication with the client, and not through the client polling Jun 08 20:55:34 we keep a connection open to the google servers Jun 08 20:55:47 so the remote end just sends data Jun 08 20:55:48 *communicate Jun 08 20:56:07 ctate, just a standard service or something? Jun 08 20:56:21 So do I need to go from a ResolveInfo to a ComponentName somehow? Jun 08 20:56:28 (I realize if you can't give away too much information) Jun 08 20:56:33 ctate, do you keep it always open or do you poll at some interval? Jun 08 20:56:33 ctate: since you have a constant connection, how does that not drain battery? Jun 08 20:56:48 i don't know the details Jun 08 20:57:04 just keeping a connection in existence takes very little juice Jun 08 20:57:30 hmm, that's very interesting Jun 08 20:57:38 yeah, ctate, that's why I was asking about interrupt vs. polling sockets :) Jun 08 20:57:38 so I'm assuming you keep it open once it boots up Jun 08 20:57:43 working on something similar. Jun 08 20:57:46 speaking of that - can I force a connection to use gprs and not wifi? (because, well.. I want to keep it alive but wifi will die when the phone is idle) Jun 08 20:58:35 ah, romainguy__, found my solution :: getLaunchIntentForPackage() Jun 08 21:02:11 Matsy are u still around buddy - having a hard time with this progress dialog Jun 08 21:05:34 What is all this stuff about intents... Jun 08 21:07:31 I'm not still around Jun 08 21:07:37 I'm going to have a huge bronchitis attack in 10 minutes Jun 08 21:07:43 So, gotta take some medicine Jun 08 21:07:47 And after that, I'm going to sleep Jun 08 21:07:56 tauno__: not possible currently Jun 08 21:08:03 tauno__: you have to write your app to be resistant to reset connections Jun 08 21:08:37 Matsy goodness, hope your going to be ok Jun 08 21:08:38 herriojr: i guess there will be a push service one day. it's not really clear if "push services" are the right architecture though imho Jun 08 21:08:49 ctate: that is kind of nuts because, from my (limited) experience, keeping any type of data connection open drains battery Jun 08 21:08:50 I will be Jun 08 21:08:53 if I take my medicine ;p Jun 08 21:09:00 Gotta send myself an email first Jun 08 21:09:03 really what you want is ipv6 networks and direct connectivity, but there are a lot of difficult questions there Jun 08 21:09:20 herriojr: bear in mind a "connection" in tcp is just some in-memory state on both computers Jun 08 21:09:21 TD: actually, everything would be fine if the stupid carriers would let me send port-directed ;) Jun 08 21:09:54 keeping it open is free, actually, with the caveat that you have to re-establish it every so often due to natural connectivity interruptions and deliberate connection resets by carrier NATs Jun 08 21:10:13 that said, i don't know off-hand how it plays with android wakelocks Jun 08 21:10:29 presumably there's something in the android kernel that makes it wake up when it gets a push from google Jun 08 21:10:34 (or anywhere) Jun 08 21:10:59 TD: I'll have to look into the TCP connection stuff then and do some research Jun 08 21:11:21 anyway, i wouldn't hold your breath for direct connectivity to phones Jun 08 21:11:44 at minimum that will require ipv6, and android doesn't properly support that yet. probably neither do most operators. and then of course to send to the phone YOU would also require a v6 connection Jun 08 21:11:58 but even once it's technically possible there are interesting security issues there Jun 08 21:12:06 what if somebody DoSs your phone? big phone bill? Jun 08 21:12:15 Not if you have a proper plan ;p Jun 08 21:12:29 someone could do the same thing with the socket you leave open for gmail, right? Jun 08 21:12:29 what happens when viruses start doing mass automated port scans over phone-space looking for windows 98 boxes? Jun 08 21:12:38 no Jun 08 21:13:01 to get packets through an already established connection you'd have to guess the port number and sequence number that's in use Jun 08 21:13:11 that's not likely to happen Jun 08 21:13:33 TD: it looks like you know a lot about this subject ;) Jun 08 21:15:08 i await the day phones are true internet citizens with anticipation Jun 08 21:15:10 TD, yeah, that's what I'm doing currently and it's a pita (connection drops, take a wakelock, device comes back from the dead, wifi turns on, reconnect over wifi for (typically takes 10-30s), release lock, wifi dies in x minutes, repeat - the battery dies really quickly to no suprise) Jun 08 21:15:26 but it'll require a major upgrade of our cell networks (and phones), not to mention data plans, before it's practical Jun 08 21:15:48 most likely there'll need to be extra protocol work ...... eg, by default a phone has an ipv6 address but is firewalled off at the edge until it specifically requests being open to the net Jun 08 21:16:22 tauno: so you leave your connection open and it drains battery? Jun 08 21:16:33 TD: On Sprint each phone has its own public IP address. Jun 08 21:16:46 herriojr, yeah, sad, I know :( Jun 08 21:17:00 tauno: I'm just trying to figure out what is different about gmail Jun 08 21:17:08 guys - can anybody tell me why i cannot see my progress dialog when i click my button http://pastebin.com/m254f18ad Jun 08 21:17:11 really? that's surprising. i assume it's allocated for a short time when first being in use Jun 08 21:17:17 i wonder what they'll do now the pre is out Jun 08 21:17:42 TD: It's not static, but it stays active for 5 minutes after your phone has disconnected from the network. Jun 08 21:17:52 tauno__: i assume the google connection has some magic to stop it thrashing around as the phone wakes up/sleeps Jun 08 21:17:54 TD: They have a *lot* of public IP space just for phones, though. Jun 08 21:18:15 TD: Other carriers use NAT for the phones because they were late to the party. Jun 08 21:18:16 kRutOn: so what happens if I fire a stream of packets at one of those IP addresses? it pops out at some cell tower? Jun 08 21:18:23 renegadeandy: why are you finishing after opening the dialog? Jun 08 21:18:34 how do you mean finishing? Jun 08 21:18:39 herriojr, the battery draining is mostly because of the frequent reconnects in my case (each reconnect can last up to 30s and requires some amount of traffic to be sent over) Jun 08 21:18:40 TD: If I recall correctly, inbound traffic is blocked by a firewall. Jun 08 21:18:45 GAH Jun 08 21:18:52 so they should really give that ip space back to iana Jun 08 21:18:57 (well, arin) Jun 08 21:19:00 hat createfeed call takes ages Jun 08 21:19:01 and ages Jun 08 21:19:22 TD: probably the main concern is the phone being woken up by the constant probes on the internet Jun 08 21:19:24 they're saving themselves the cost of NAT by taking up a ton of IP space that could be much better used Jun 08 21:19:28 right, definitely Jun 08 21:19:37 renegadeandy: you do showDialog(PROGRESS_DIALOG); finish(); Jun 08 21:19:41 NAT wasn't meant for what it's being used for today. Jun 08 21:19:51 that's what i was saying ..... doesn't make sense to expose phones to the internet today. so you may as well use NAT and preserve the ip space. Jun 08 21:19:51 renegadeandy: finish() closes your activity Jun 08 21:19:57 (until phones speak v6) Jun 08 21:20:02 so your dialog won't display Jun 08 21:20:08 phones speak IPv6 right now Jun 08 21:20:09 yeah - thats fine, the createfeed call will take an age to return control to this class Jun 08 21:20:15 TD, yeah, has to be some magic :) Jun 08 21:20:24 well, not all of them, but I've used them Jun 08 21:20:38 ok well i took it out - still doesnt display Jun 08 21:20:42 renegadeandy: putting finish after you try and show your dialog won't show the dialog Jun 08 21:20:46 just blocks for about 1 minute until the call returns Jun 08 21:21:12 it does show dialog - then it does createfeed - this call will takre a bout a minute Jun 08 21:21:17 then it calls finish when it returns Jun 08 21:21:55 kRutOn: not android :) Jun 08 21:21:57 renegadeandy: You're doing network stuff in the UI thread. Jun 08 21:21:58 (well not fully) Jun 08 21:22:17 kRutOn... Jun 08 21:22:25 i am makin a new thread for the ui bit ament i Jun 08 21:22:59 renegadeandy: You're starting a network call in the onClick method Jun 08 21:23:27 yes... Jun 08 21:23:27 and Jun 08 21:23:54 renegadeandy: ... the thread that calls onClick is the UI thread Jun 08 21:24:11 ok.... Jun 08 21:24:16 so what are u suggesting i do Jun 08 21:24:45 start a new thread and put all that in the new thread Jun 08 21:25:02 and keep showDialog() where it is? Jun 08 21:25:17 so i tried making a new thread, and it started spraffing on about a handler? Jun 08 21:25:29 try reading the docs for AsyncTask Jun 08 21:26:24 me? Jun 08 21:26:38 renegadeandy: I don't see anywhere where you're sending a message to the handler to update the progress either. Jun 08 21:26:46 yes Jun 08 21:27:17 oh, I misunderstood his question Jun 08 21:27:54 i would do that in the other code in other classes Jun 08 21:28:03 can somebody just tell me how to do a thread Jun 08 21:28:06 with a handler thing Jun 08 21:28:15 aynctask is a little more than is needed here Jun 08 21:28:17 I suggest you read the documentation. Jun 08 21:28:39 yes i know kRutOn but there is a very large amount and i need some direction, i dont want to use asynctask Jun 08 21:28:40 renegadeandy: or check the lunar lander sample Jun 08 21:28:46 renegadeandy: it does that Jun 08 21:28:54 why not? asynctask solves your problem. Jun 08 21:28:57 renegadeandy, why not? asynctask rules Jun 08 21:29:02 really? Jun 08 21:29:02 it was designed to make this easy and avoid the need to screw around with threads and handlers Jun 08 21:29:13 threads/handlers are way more complicated Jun 08 21:29:17 it seems complicated i dont really understand how to use it Jun 08 21:29:19 that said it's actually tough to use because of the *?#$! android lifecycle Jun 08 21:29:20 and don't offer any benefits Jun 08 21:29:33 TD, yeah, but threads aren't any easier Jun 08 21:29:33 well, you need to learn a bit about how gui software [in java] works first then Jun 08 21:29:46 ..i no how gui in java works... Jun 08 21:29:53 an explicit thread, i think, is easier to propagate across activity reconstruction Jun 08 21:29:54 renegadeandy: what KNY said about asynctask. they rules Jun 08 21:29:59 without a s Jun 08 21:30:04 good for it - example? Jun 08 21:30:08 an asynctask can't be easily disconnected and reconnected to a new activity AFAIK Jun 08 21:30:22 renegadeandy, they're all over. Look for the blog posts by romain guy on how to use it Jun 08 21:30:29 renegadeandy: dude, third hit on google Jun 08 21:30:30 http://android-developers.blogspot.com/2009/05/painless-threading.html Jun 08 21:30:57 TD, it should be able to do it since there aren't any references to contexts, etc. That said, it gets tricky when it finishes before the UI has been built up again... Jun 08 21:31:01 There are also companies you can pay to write the program for you. Jun 08 21:31:25 kRutOn, :) Jun 08 21:31:26 TD: I've never tried to connect a thread to a different activity, are there examples on that? Jun 08 21:32:17 KNY: right, that's what i meant .... Jun 08 21:32:37 KNY: when you do it yourself, you can move the thread using onRetain..... and then check if it finished in onCreate Jun 08 21:32:43 i'm not sure how to do that with an asynctask Jun 08 21:33:24 i guess you could do a get with a zero timeout Jun 08 21:33:28 TD, you can pass a task through onRetain... but it could finish in the process Jun 08 21:34:12 TD, but I see your point Jun 08 21:34:58 yeah. it's a bit tricky. you need to write your onProgressUpdate and onPostExecute with the possibility in mind that the activity won't be running anymore Jun 08 21:35:13 because realistically, an AsyncTask isn't very useful unless you pass in a context Jun 08 21:35:21 TD: which class has onRetain? Jun 08 21:35:25 what would onProgressUpdate and onPostExecute do, except update the ui? Jun 08 21:35:31 herriojr: sorry, onRetainNonConfigurationInstance or whatever it's called Jun 08 21:35:38 ah ok, thanks Jun 08 21:36:10 herriojr, look at romainguy's curious-creature blog entry about faster UI rotations Jun 08 21:36:13 KNY: so you need to pass in the activity to the asynctask. then when it is destroyed, you need to clear it. that means you need to synchronize on that activity reference. Jun 08 21:36:23 TD, yeah Jun 08 21:36:33 i wonder what romainguy would recommend Jun 08 21:36:39 WWRGD? Jun 08 21:36:45 I really need to bookmark romainguy's pages Jun 08 21:37:04 i read the code to shelves. it solves this problem in an interesting way ..... rotating the screen cancels the asynctask, serializes some state and then it's restarted in the new activity Jun 08 21:37:15 which feels like a bit of a cop-out Jun 08 21:37:56 TD, yeah, that's what I do in my stuff Jun 08 21:38:14 he doesn't actually save the state; he saves whether it started, was working, or had finished Jun 08 21:38:23 and if the state was working, just restart Jun 08 21:38:28 KNY: i think to solve this one in a convenient manner, you'd need to extend both asynctask and activity. activities should be able to take ownership of an asynctask in the same way that they can own dialogs, cursors etc Jun 08 21:38:36 which annoys me to no end because it means the work is done twice Jun 08 21:38:43 actually the new task picks up from where the old one left Jun 08 21:39:06 TD: yeah I tried that but it wasn't actually giving you much advantage Jun 08 21:39:15 it was the notion of managedTasks Jun 08 21:39:22 romainguy, at exactly the same place? like, if you were downloading something, it would just continue the download? Jun 08 21:39:32 KNY: you could yes Jun 08 21:39:55 romainguy, do you have an example of that somewhere? it's possible I just mis-read the shelves code Jun 08 21:40:18 shelves does that for the books import Jun 08 21:40:20 so a managedTask was one where the activity would null out in onDestroy and set a reference to itself in onCreate? then the asynctask can say, hey, if activity ref is null, don't do anything until setActivity is called, then post the handler message Jun 08 21:40:26 if you have imported 300 books out of 700 Jun 08 21:40:30 it picks up at 301 Jun 08 21:40:43 I didn't bother saving the current book import because it's usually not much data to redownload Jun 08 21:40:47 that way the tasks onProgressUpdate/onPostExecute would be guaranteed to run, but after onCreate Jun 08 21:40:49 no race Jun 08 21:41:07 interesting; I'll have to go re-example the shelves code. How would you pick up where a download left off, though? would you have to pass the HttpClient around? Jun 08 21:41:19 sure Jun 08 21:41:28 interesting Jun 08 21:41:32 * KNY reads more Jun 08 21:41:34 that's what onRetainNonConfigWhatever is good at Jun 08 21:41:42 KNY cheers - got asyncstate displaying the gui now Jun 08 21:41:47 or you could use Request-Range for a long running download, if you wanted to survive process kills Jun 08 21:41:49 however it says the app has been forced to close!?!?! Jun 08 21:41:50 http://pastebin.com/m5b0f61fd Jun 08 21:41:53 any ideas why? Jun 08 21:42:01 the app appears to still be running in the background Jun 08 21:42:09 renegadeandy, post your stack trace Jun 08 21:42:09 but the wee dialog saying it needs to shut is appearing Jun 08 21:42:27 romainguy: why do you say it didn't buy much? Jun 08 21:42:41 renegadeandy: can we get the logs? Jun 08 21:42:43 thats the stak trace - http://pastebin.com/md5b3e1c Jun 08 21:42:44 romainguy: i don't think it's possible to solve this (admittedly unlikely?) timing problem without some concept of managed tasks Jun 08 21:43:01 yes it is Jun 08 21:43:09 romainguy, okay, so you would pass the HttpClient through the rotation? on the mailing list I believe it was dianne said we could pass the AsyncTask through (though it brings about the problems that TD is mentioning) Jun 08 21:43:15 there's nothing a managed task would do you cannot do yourself Jun 08 21:43:30 KNY: you can pass the AsyncTask through Jun 08 21:43:31 well, sure, obviously we can extend the framework by subclassing activity and asynctask ourselves :) Jun 08 21:43:37 but, it'd be convenient if the framework did it for us Jun 08 21:43:54 how hard is it to just write: myTask.targetActivity = this in onCreate()? Jun 08 21:44:06 renegadeandy, you're modifying the UI from doInBackground() Jun 08 21:44:31 romainguy, but that's an extra line! I want the framework to do everything for me and make me a sandwich, too! Jun 08 21:44:36 romainguy: that's not enough though. what if the task finishes in the middle of task reconstruction? Jun 08 21:44:45 and that's why I'm convinced we made the framework too easy to use Jun 08 21:44:54 KNY how ? Jun 08 21:44:56 romainguy: if you do myTask.targetActivity = this in onCreate, and the equivalent = null in onDestroy, there's a window of time when you could get an NPE Jun 08 21:44:59 romainguy, should've gone with ASM only :) Jun 08 21:45:03 TD: what do you think the managed task would do for you here?? Jun 08 21:45:10 TD: er, check against NPEs? :) Jun 08 21:45:10 renegadeandy, I assume line 109 Jun 08 21:45:11 renegadeandy: remember, there were 3 functions, doInBackground, onProgressUpdate and onPostExecute Jun 08 21:45:25 I mean, check against null :) Jun 08 21:45:29 no, it'd avoid calling any of the methods that are meant to run in the ui thread until myTask.setTargetActivity() was called Jun 08 21:45:30 TD, could just wait in onPostExecute() until you have a valid activity again Jun 08 21:45:38 you can't really wait though Jun 08 21:45:52 yeah but AsyncTasks are just that Jun 08 21:45:57 they are NOT tied to Activities Jun 08 21:46:05 KNY it doesnt modify the ui - it just needs the context for the db management class... Jun 08 21:46:28 renegadeandy: comment out like 99. it doesn't nothing and is causing your problem Jun 08 21:47:01 now I know what it is like dealing with me, sorry romainguy Jun 08 21:47:06 ah yeah, your goofy indentation (seriously, set up Eclipse's code formatter) threw me off Jun 08 21:47:10 herriojr: :p Jun 08 21:47:35 (that was to renegadeandy by the way) Jun 08 21:47:36 what are onProgressUpdate and friends meant to do, if not update the ui of an activity? if it was just myTask.targetActivity = this i'd agree with you, but it's not Jun 08 21:47:53 i don't think it makes sense to call onProgressUpdate or onPostExecute when there's no activity running Jun 08 21:48:07 perhaps it's not actually possible, maybe the message queue isn't pumped in between activity reconstruction Jun 08 21:48:11 all a task does is communicate with the UI thread Jun 08 21:48:15 it has nothing to do with activities Jun 08 21:48:22 you can write a task that only knows about a view Jun 08 21:48:23 lo Jun 08 21:48:34 AsyncTask does not and will NOT know about Activity Jun 08 21:48:49 now, we could have a specialized subclass of AsyncTask in the framework that would Jun 08 21:48:52 damn you, romainguy . I think that every time I talk to you, I feel the urgent need to go rewrite huge portions of my code :) Jun 08 21:48:53 keeping a View reference in an AsyncTask will leak a context though, right ? Jun 08 21:48:55 anybody know how to get an headphone insert type of event or how to check for the inserted headphone? Jun 08 21:49:04 if the user rotates the screen whilst it's running .... Jun 08 21:49:05 romainguy: I have a quick question regarding relativelayout's if you do not mind, I was following your example on the blog for the image + 2 text view relative layout for a listview, and was getting very erratic layouts happening because the relative layout in my listview was not placed within a framelayout, but doing so made everything behave as you'd expect, my question is: why is this so and is this always required for relati Jun 08 21:49:08 tahts the stuff thanks kRutOn - can anybody explain the principle behind intents to me? Jun 08 21:49:14 TD: and keeping a reference to an Activity does not? :) Jun 08 21:49:25 ok, let me code up what i mean Jun 08 21:49:30 I know what you mean Jun 08 21:49:36 and I told you I agree it should be simpler Jun 08 21:49:37 blkhawk, I think there is a NOISY_AUDIO (or something) intent for that Jun 08 21:49:42 but the solution is NOT to hack AsyncTask Jun 08 21:49:49 renegadeandy, d.android.com Jun 08 21:49:57 or at least not in a way that makes AsyncTask aware of Activity Jun 08 21:50:05 renegadeandy: http://developer.android.com/guide/topics/fundamentals.html Jun 08 21:50:27 KNY: thanks i can google for that Jun 08 21:50:50 a *lot* of noise about Android and headphones or the lack thereof Jun 08 21:50:53 blkhawk, look in the AudioManager docs Jun 08 21:51:00 I'm certain I saw it around there the other day Jun 08 21:51:22 I want to build a car-mode detector Jun 08 21:51:41 blkhawk, http://d.android.com/reference/android/media/AudioManager.html#ACTION_AUDIO_BECOMING_NOISY Jun 08 21:51:47 so i can run GPS tracking and the car is the only place where i have headphones and power Jun 08 21:52:48 since when are headphones legal while driving? ;) Jun 08 21:53:10 romainguy: so there'd be an ActivityAsyncTask then ? Jun 08 21:53:16 ctate: I don't think it distinguishes between headphones and external audio out Jun 08 21:53:21 that would make a lot more sense Jun 08 21:53:49 hey, so I noticed that in some things that some colleagues wrote of mine, when they are running stuff in a thread started by a service, it slows down the phone a lot...I'm assuming the way to fix this is to just put in some periodic waits/sleeps to make sure they don't use so much of the processor's time? Jun 08 21:53:50 but such a task could lead to weird bugs if you're not careful about using it Jun 08 21:54:02 *colleagues of mine wrote Jun 08 21:54:04 when you use it as an innner class (non-static) of your Activity Jun 08 21:54:09 and not careful about using the "target" Jun 08 21:54:18 anyway, I want to make that easier Jun 08 21:54:29 yeah. as far as i can tell it's never right to use a non-static inner asynctask subclass Jun 08 21:54:34 but I did not do it in Cupcake because it wasn't that easy to figure out the right API Jun 08 21:54:36 romainguy, a thought I had earlier was to have a service in the backend that the UI communicates with for all network-related stuff (since rotation changes wouldn't affect anything); is this a terrible idea? Jun 08 21:54:51 TD: it can be, if you don't care about keeping it across rotations Jun 08 21:54:53 i just think it makes sense to put in AsyncTask, because all the docs talk about using it to make updating the UI during/after a background operation Jun 08 21:54:56 or if you handle the rotation yourself Jun 08 21:55:02 no it does NOT make sense Jun 08 21:55:11 romainguy, haha, thought so Jun 08 21:55:17 the AsyncTask can work with views directly Jun 08 21:55:34 or just any object you have that participate in the UI Jun 08 21:55:46 it would be very wrong to tie the API to Activity Jun 08 21:56:04 i thought, a View cannot meaningfully exist outside an activity. i mean you could create one, but it wouldn't be useful for very much. Jun 08 21:56:08 oh wait, you're talking to TD :) sorry Jun 08 21:56:22 TD: that does not mean the AsyncTask should know about the Activity directly Jun 08 21:56:37 besides, Views are tied to a Context, not an Activity Jun 08 21:56:40 (cf dialogs for instance) Jun 08 21:57:09 huh, so, it'd be technically valid (albiet bad ui) for a service to use an asynctask to display a dialog when done? no activity required? Jun 08 21:57:36 as long as the task is created on the UI thread, sure Jun 08 21:57:42 you can create a toast too if you want Jun 08 21:57:45 i guess a notification is a better example than a dialog for the service case Jun 08 21:57:51 but my point with dialogs is that dialogs contain views Jun 08 21:57:52 ok, so, i see what you mean now. Jun 08 21:57:57 and dialogs are contexts, but they are not activities Jun 08 21:58:16 and Services are contexts, but are not activities Jun 08 21:58:28 got it. i haven't dealt with ui outside of activities. i suppose appwidgets are another example of "stuff that must be done on the ui thread but is not an activity" Jun 08 21:59:59 i don't think this audio noisy thing is what i am looking for Jun 08 22:00:36 i might be able to fudge something with it mut i would rather have a clean noteification when a headset is plugged in to work with Jun 08 22:01:10 blkhawk: erm, Intent.ACTION_HEADSET_PLUG Jun 08 22:01:23 broadcast intent Jun 08 22:01:30 ah Jun 08 22:01:37 ctate: why didn't you say so :D Jun 08 22:01:39 ty Jun 08 22:01:42 i did! Jun 08 22:01:50 i just now glanced at what you'd been talking about Jun 08 22:01:58 and thought hey, i wonder if there's a broadcast for that Jun 08 22:02:01 and checked Intent Jun 08 22:02:02 et voila Jun 08 22:02:04 hah - servs meright for working with eclipse on the other monitor ;) Jun 08 22:02:16 blkhawk, heh, sorry :) Jun 08 22:02:17 we live and learn :) Jun 08 22:02:36 still getting my legs with this API Jun 08 22:02:41 romainguy: is it actually possible for handler messages on the ui thread to be dispatched between activity destruction/reconstruction on configuration change? Jun 08 22:02:58 i hate how one is helpless for the first 20 hours working in a new language Jun 08 22:03:05 (i guess what i really mean is, if it isn't, is that a guarantee or just a quirk of how it's implemented ..... guess it's not in the docs, so, no guarantee) Jun 08 22:04:47 the configuration change relaunch is sort of special Jun 08 22:05:00 argh eclipse rebuilding or i'd verify for you Jun 08 22:05:02 (handler.postDelayed() will fire just fine after activity.onDestroy()) Jun 08 22:05:22 tauno__: even in the middle of a relaunch destroy/create sequence for orientation change? Jun 08 22:05:30 ctate, do you do platform development in eclipse? is there some trick to get that to work? Jun 08 22:05:47 KNY: no, i don't, but eclipse has to compile everything anyway to do syntax coloring etc Jun 08 22:05:58 ah Jun 08 22:06:00 and for some reason every so often it decides it has to rebuild the world on me Jun 08 22:06:02 gr rar Jun 08 22:06:09 you could turn that off Jun 08 22:06:26 projects -> [ ] build automatically Jun 08 22:06:32 ctate, dunno, just tried to post one and then killed the activity and the event fired - didn't try orientation change Jun 08 22:06:36 s/projects/project/ Jun 08 22:06:55 hey guys - think i got it working now - can you please just say if this is correct! http://pastebin.com/m63aa2408 Jun 08 22:07:01 okay, yeah, i was right: relaunch for config change is essentially atomic Jun 08 22:07:21 it is? hm.. good to know Jun 08 22:07:34 ah ha Jun 08 22:07:37 that simplifies things a lot! Jun 08 22:07:37 configurationchange / pause / destroy / launch is handled on a single Handler event Jun 08 22:07:40 or how atomic is atomic? :P Jun 08 22:07:42 assuming it's reliable Jun 08 22:08:10 i'd be kinda hesitant to actually rely on that though. i sense an app compatibility problem in the future, if that isn't documented :) Jun 08 22:08:12 tauno__: ActivityThread.handleRelaunchActivity(), for your reference :) Jun 08 22:08:17 ctate, so an asynctask can't fire onPostExecute() in the middle? Jun 08 22:08:20 TD: yeah Jun 08 22:08:20 any1... Jun 08 22:08:25 that would appear to be the case, yes Jun 08 22:08:26 KNY: i don't *think* so Jun 08 22:08:41 hmm Jun 08 22:08:42 renegadeandy, we're not testers; please try it and see if it works Jun 08 22:08:50 ctate, interesting... Jun 08 22:09:04 * KNY goes off to test passing AsyncTask through rotations Jun 08 22:09:09 i think i will ask on android-platform if this can be made a platform guarantee Jun 08 22:09:17 or maybe it should be a bug Jun 08 22:09:32 it's a good question Jun 08 22:10:04 i'm inclined to make it a guarantee to try to keep the behavior more closely similar to the case where the activity handles its own configuration changes Jun 08 22:10:20 I would love it if it were a feature :) Jun 08 22:10:31 but i don't know the background of the design and would like to have the conversation Jun 08 22:10:48 * ctate does read android-platform, btw Jun 08 22:11:06 its working, but dont no if its the correct practice... Jun 08 22:11:25 could i pass the handler to my other classes now, and update it from there... Jun 08 22:12:13 renegadeandy, are you using AsyncTask and a Handler? Jun 08 22:12:20 yea Jun 08 22:12:31 so i use asynctask and handler for the progress Jun 08 22:12:38 can i pass the handler to other calls within asynctask Jun 08 22:13:10 you shouldn't need both Jun 08 22:13:21 romainguy: in ur photostream app, u used retainconfiguration so that u don't have to get the photos from flickr again Jun 08 22:13:27 renegadeandy, please read the docs on asynctask, specifically onPublishProgress Jun 08 22:13:47 yeah , but if i use onpublish progress - i cant make that call from other classes Jun 08 22:14:05 btw, what did you guys do to jbq? :) Jun 08 22:14:54 * kRutOn . o O ( the record player skips and stops and everyone turns to glare at tauno__ ) Jun 08 22:14:54 is it possible to retain the state of a thread and resume from where it started by using retainconfiguration? Jun 08 22:15:10 or rather where it stopped Jun 08 22:15:33 tauno__: vacation Jun 08 22:15:34 the thread will keep running Jun 08 22:15:38 chouman82: you can pass the thread along :) Jun 08 22:16:10 romainguy, ah ok, didn't know you were allowed to get vacations there :) Jun 08 22:16:14 haha Jun 08 22:16:17 so if the thread is currently fetching photos, i can just pass that thread over and it will continue to run without getting killed? Jun 08 22:16:29 yeah seriously, what do you guys think weekends are for? ;-) Jun 08 22:16:29 yes Jun 08 22:16:51 chouman82: an activity being "destroyed" really just means some methods on a java object being called. the process itself doesn't die. Jun 08 22:17:22 but retainconfig only takes in one onject right? Jun 08 22:17:47 yes Jun 08 22:17:53 why would you need more than one ? Jun 08 22:17:59 hi all, i'm beginning android developement and have some props with preferences... is someone around thats willing to help me out a bit? Jun 08 22:18:18 well for instance in the photostream app, it passed the already fetched photos when orientation changes Jun 08 22:18:28 rac2030, don't ask to ask; just ask :) Jun 08 22:18:37 chouman82: but you can pass any object you want Jun 08 22:18:41 chouman82, one object is also an array containing other objects.. so it takes as much as you want :) Jun 08 22:18:42 so you can create you rown structure Jun 08 22:18:46 KNY: ok ;-) Jun 08 22:18:49 if I recall correctly Photostream passes an array of images Jun 08 22:19:03 yea i just realized that as i was going to type other stuff Jun 08 22:19:12 yea array of images Jun 08 22:19:35 romainguy: so yeah you're right. there's no need to extend AsyncTask, assuming the atomicity of reconfiguration can be relied upon in future versions of the os Jun 08 22:19:47 TD: I'm pretty sure you can rely on that Jun 08 22:19:53 cool Jun 08 22:19:54 not doing so would cause tons of issues Jun 08 22:20:04 I guess we should document that Jun 08 22:20:05 romainguy: did you see the earlier questions about that? yeah, i think it'd be good to make it an explicit (i.e. documented) guarantee. Jun 08 22:21:18 yep, one sentence in the activity javadoc would do the trick (and then maybe an example in the asynctask javadoc of moving it between activities, just to make it super explicit) Jun 08 22:21:47 it should be more than one sentence, and in several different places. Jun 08 22:21:54 that works fo rme too :) Jun 08 22:23:22 patches are welcome :) Jun 08 22:23:44 hmm. last time i contributed a patch to the docs it was merged, then cupcake shipped months later without the patch. so i think i'll let you guys do it :) Jun 08 22:23:47 I have one preference activity where is set the preferences and i have in the logic of my main activity a part where i need to read preferences and do accoridng action... writting is no prob but on my main activity i tried SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); but this is giving me uncaught exception and kills and shuts down the wm if i try to open the preferences activity... I Jun 08 22:23:47 think it's something about how I get the sharedPreference settings thats causing the crash in the native call Jun 08 22:23:54 at least until the whole public/private two way merge thing is sorted out Jun 08 22:23:57 I guess I can't force TextView into making "google" look just like a clickable link "google" (without the )? I'd have to use a webview for that, right? Jun 08 22:24:12 tauno__: well you can use your own urlspan Jun 08 22:24:19 webview just to make a clickable link is pretty heavy Jun 08 22:24:51 I can make my own.. what? Jun 08 22:25:01 * tauno__ goes back to his cave reading the docs Jun 08 22:25:05 just a sec Jun 08 22:25:11 lemme dig out the code i used to do this Jun 08 22:26:02 tauno__, yeah, just use android:autoLink="web" Jun 08 22:26:24 er wait Jun 08 22:26:40 I have autolink="all" and that just makes the "google.com" part clickable and leaves everything else in as plaintext Jun 08 22:26:44 tauno__, look at ApiDemos, there's definitely an example there Jun 08 22:26:53 tauno__, Link*.java maybe Jun 08 22:28:15 tauno__, yeah, Link.java in ApiDemos Jun 08 22:28:53 thanks Jun 08 22:29:23 gah. i started eclipse. big mistake. Jun 08 22:29:43 heh Jun 08 22:29:48 just go get some coffee or something Jun 08 22:30:03 hmm, it's 12:30am here. maybe i'll skip the coffee :) Jun 08 22:30:09 s/coffee/sleep/ Jun 08 22:35:14 using textView.setMovementMethod(LinkMovementMethod.getInstance()); made the anchor look like a real link, yay! but it isn't clikcable Jun 08 22:35:26 there's something more I have to set I guess? :) Jun 08 22:35:52 try this Jun 08 22:35:52 http://pastebin.com/m1d3defbb Jun 08 22:36:09 now, that will make the whole text view a link Jun 08 22:36:27 you can change the zero and the s.length() to control which part is linkified Jun 08 22:36:43 don't ask me what SPAN_EXCLUSIVE_EXCLUSIVE does. i wrote this code months ago :) Jun 08 22:36:52 TD, did you check out Html.fromHtml(String) ? Jun 08 22:37:31 huh Jun 08 22:37:34 i didn't know about that Jun 08 22:37:43 ApiDemos is your friend :) Jun 08 22:37:46 yeah, that looks like it would do a better job :) Jun 08 22:38:31 ah Jun 08 22:38:35 i appear to have an out of date ApiDemos Jun 08 22:38:36 textView.setLinksClickable(true); is not helping in making the links clickable, sadly Jun 08 22:38:50 the one I have has a text/linkify demo, but it seems to be out of date w.r.t the copy i found in codesearch Jun 08 22:39:51 I must be doing something else really silly because it works in api demos.. oh well :) Jun 08 22:42:19 yeah, figures.. Jun 08 22:43:17 note to myself: don't try to do anything meaningful at 01:43am Jun 08 22:43:37 lol, http://developer.android.com/reference/android/text/BoringLayout.html Jun 08 22:43:38 I was setting the movement method of another textview :) Jun 08 22:43:40 good api naming there :) Jun 08 22:43:53 "You will probably never want to make one of these yourself; if you do, be sure to call isBoring(CharSequence, TextPaint) first to make sure the text meets the criteria. " Jun 08 22:43:58 i feel so depressed :) Jun 08 22:44:04 TD, romainguy, what is wrong with the way that this ( http://pastebin.com/d647af543 ) is written? if I rotate before the LongTask has finished, then mText never gets updated. If I never rotate, it works just fine. Jun 08 22:44:30 TD, haha, just the name "BoringLayout" makes me laugh. Someone must have had fun writing that Jun 08 22:45:06 (if you want the extremely simple APK of that, I can send it) Jun 08 22:45:20 KNY: well, the activity changes! so you need to (1) make it a static inner class and (2) manually set an activity reference Jun 08 22:45:30 TD, ahh, duh Jun 08 22:46:03 otherwise mText is pointing to some old view that is no longer going to be rendered .... and you leak an activity that way :) Jun 08 22:46:07 hrmm, i've switched back to Ubuntu on one of my machines, and i've just plugged up my phone but adb or the DDMS can't see it Jun 08 22:46:21 i've googled for it, but can't find anything - what am i doing wrong? Jun 08 22:46:26 TD, makes sense Jun 08 22:46:32 it's tricky isn't it Jun 08 22:46:42 digitalspaghetti, `sudo $(which adb) kill-server && sudo $(which adb) devices` Jun 08 22:47:05 but RG has a point .... i'm not sure how the api could be made better to avoid this. perhaps asynctask could somehow detect that it's not static and throw an exception, or something Jun 08 22:47:07 happens when you don't have your groups set up properly or something Jun 08 22:47:25 or maybe the eclipse plugin should include a customized FindBugs/PMD :-) Jun 08 22:47:29 heh Jun 08 22:47:32 findbugs is sweet Jun 08 22:47:45 but this also means that my UI components need to be public, no? Jun 08 22:47:54 LoginFilter.UsernameFilterGMail This filter rejects characters in the user name that are not compatible with GMail account creation. Jun 08 22:47:57 nice :) Jun 08 22:48:18 KNY: don't think so. you should be able to tweak the outer classes fields .... Jun 08 22:48:26 err, yeah, sorry Jun 08 22:48:38 had another compilation error :) Jun 08 22:48:42 perfect KNY thanks Jun 08 22:48:56 it's a fresh install, so it's probably not set up right :) Jun 08 22:49:08 digitalspaghetti, neither is mine :-/ Jun 08 22:49:19 I just aliased that to restartadb in my .bashrc :) it's easier haha Jun 08 22:49:41 yea, i just created a little bash script there for it :) Jun 08 22:51:21 KNY: well the longtask is updating the old mText Jun 08 22:51:36 an easy way to fix this is simply to not reference mText in onPostExecute Jun 08 22:51:43 romainguy, yep, sorry for the extra highligh; TD got it sorted for me Jun 08 22:51:43 but instead do a findViewById() Jun 08 22:51:46 guys - ever since i changed to using asynctask - all my debug log.i("debug",msg) have stopped appearing, how come Jun 08 22:51:50 romainguy, isn't that expensive? Jun 08 22:51:57 for a one time call? Jun 08 22:51:58 no Jun 08 22:52:10 romainguy, ahh, even better then! thanks Jun 08 22:52:12 findViewById will still be invoked on the old activity though right Jun 08 22:52:22 it really needs to be a static inner class Jun 08 22:52:22 yes you need to target the new activity Jun 08 22:52:46 ,. Jun 08 22:53:05 ah, so you still need to pass in the new activity reference? Jun 08 22:53:25 anybody Jun 08 22:53:50 renegadeandy, patience is a virtue Jun 08 22:53:56 KNY: yeah and that's why we were talking about managed tasks earlier Jun 08 22:54:01 were that would somehow be done for you Jun 08 22:54:04 KNY: yeah. otherwise once it's static, how will you call findViewById? Jun 08 22:54:11 romainguy, yeah, I watched that with half an eye Jun 08 22:54:30 TD, yeah, that's why I was checking. But couldn't that lead to a race condition? Jun 08 22:54:36 you didn't miss much :) romainguy is right, it doesn' buy you much once you can assume reconfiguration is atomic Jun 08 22:54:41 no Jun 08 22:54:42 KNY yeah - its a virtue im still seeking - think i got it fixed by restarting eclipse - Jun 08 22:54:58 between the steps of restoring the task and setting the activity, couldn't the LongTask finish? Jun 08 22:55:00 there is no race. the ui parts of asynctask can't be called in between a reconfiguration Jun 08 22:55:04 ahh Jun 08 22:55:12 oh right, they're called on the UI thread; duh Jun 08 22:55:25 sorry guys; I should have read that more carefully :) Jun 08 22:55:28 np Jun 08 22:55:45 it should be safe to just assign a ref in onCreate, and null it out in onDestroy Jun 08 22:55:47 this should help clean up a lot of my code, I'm ashamed to admit Jun 08 22:55:56 then use it in the ui thread parts of asynctask. it's guaranteed to never be null Jun 08 22:56:04 yeah, well, join the club Jun 08 22:56:11 i only recently got rid of the RPC goop from my service :) Jun 08 22:56:25 i didn't see the LocalService API demo until too late. something else that'd be good to document. Jun 08 22:56:32 heh Jun 08 22:56:39 they accept documentation patches, IIRC... Jun 08 22:56:42 ;) Jun 08 22:56:44 and i just discovered i didn't need to implement my own String.join method Jun 08 22:56:53 yikes, you should never do that Jun 08 22:56:57 strings are immutable Jun 08 22:57:04 well, you know what i mean Jun 08 22:57:05 StringBuilder, my friend Jun 08 22:57:48 well there's TextUtils.join which does what i wanted :) Jun 08 22:58:03 how does that do it? Jun 08 22:58:08 * KNY opens the source Jun 08 22:58:14 KNY: i'm not gonna write any more doc patches until they actually guarantee merged patches will appear in the next release Jun 08 22:58:32 TD, heh Jun 08 22:58:42 i fixed the "WebView is deprecated" doc bug and wrote some more javadocs for it back in feb. guess what bug the cupcake sdk shipped with? :( Jun 08 22:58:53 hey Jun 08 22:58:58 we're going as fast as we can Jun 08 22:59:02 your work is not lost Jun 08 22:59:03 i know :) Jun 08 22:59:17 and hey, they're hiring, so go apply ;) Jun 08 22:59:19 hence the "until" part. i want to write more patches, i'm just gonna wait Jun 08 22:59:26 KNY: lol, i already work for google :) just not on android Jun 08 22:59:50 TD, yeah, TextUtils.join() just uses a StringBuilder internally Jun 08 23:00:03 TD, nice, can you elaborate more or is it uber-secret? Jun 08 23:00:10 i work on maps Jun 08 23:00:16 (currently) Jun 08 23:00:21 nice, improve the Maps android app :) Jun 08 23:00:41 TD: if you work for Google, submit patches internally... Jun 08 23:00:42 * TD has a much improved version running on his phone Jun 08 23:00:55 romainguy: yeah, i figured i'd do it the external way, as that's actually better documented :) Jun 08 23:01:04 i should dig up how to set up repo for the internal tree Jun 08 23:01:14 I just sent in my application last week, so I'm requesting to not interview with romainguy because then he'll just think back to all the stupid questions I ask in here ;) Jun 08 23:01:23 heh, good luck :) Jun 08 23:01:38 haha, thanks. It's for an internship in the fall. Jun 08 23:04:13 so, continuing on the AsyncTask discussion, when I rotate the screen, the simple thing to handle the task would be to just cancel it in onStop or onDestroy, right? Jun 08 23:04:42 KNY: but I can look you up in the db and give negative feedback :p Jun 08 23:04:46 herriojr: the conclusion seems to be, just pass it through onRetainNonConfigurationInstance Jun 08 23:05:13 herriojr: being careful to [a] ensure your asynctask is static, and [b] ensuring you set a ref to your activity in onCreate and [c] null it out in ondestroy Jun 08 23:06:12 nice and simple :) Jun 08 23:06:13 TD: ok, cool Jun 08 23:06:25 TD: what if it finishes while rotating? Jun 08 23:06:46 that doesn't matter. it's impossible for the UI parts of the asynctask to be called in the middle of a rotate. Jun 08 23:06:47 onPostExecute() will be called after the new activity is created Jun 08 23:09:21 how do I make sure it knows what UI elements to update after the rotation if the view objects have changed, is it okay to pass them in as parameters when creating the object? Jun 08 23:09:45 it is my assumption that the UI elements are no longer the same after rotation (different addresses) Jun 08 23:09:57 so if I need to set the text on a view Jun 08 23:10:32 ignore the question, it is somewhat gibberish Jun 08 23:11:07 no, you can give your asynctask an explicit reference to the activity Jun 08 23:11:12 hmmm. maybe i should write an example. Jun 08 23:11:34 TD: as long as the reference is cleared in onDestroy? Jun 08 23:13:11 http://pastebin.com/m3d7bb775 Jun 08 23:13:19 that's a modification of KNYs code to be correct Jun 08 23:13:27 also Jun 08 23:13:27 (well, sorta. i didn't test or even compile it) Jun 08 23:13:34 you do not need to save/restore the state of the TextView yourself Jun 08 23:13:36 i already see a problem :) Jun 08 23:13:42 all you need is to give TextView an id Jun 08 23:13:54 TD: yeah your code doesn't work :p Jun 08 23:14:10 mTask = this; Jun 08 23:14:23 already fixed that one Jun 08 23:14:55 ok, i deleted the code to do with saving the textviews content to focus on the task Jun 08 23:15:21 anyway, it should be something like that Jun 08 23:15:23 * TD -> sleep Jun 08 23:17:52 ok cool, thanks TD Jun 08 23:52:08 not to be an idiot, (I'm not a true java developer), but what is the advantage of having a static nested class over a static class (especially in the instance of the example TD provided) Jun 08 23:53:42 herriojr: i cant really parse that question. what do you mnean by "over a static class"? you mean, over a class in a separate file? Jun 08 23:54:40 jasta: in the example TD provided, what is the reasoning for using a static nested class instead of just a regular old nested class? Jun 08 23:54:54 what example? Jun 08 23:55:07 http://pastebin.com/m3d7bb775 Jun 08 23:55:14 hey guys, i am trying to obtain an rss file and print out all its contents - however my code seems to stop after the first set of lines - this is the method : http://pastebin.com/m5e349272 and this is the rss file : 06-09 00:49:31.117: http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/teams/d/dundee/rss.xml Jun 08 23:55:20 I don't quite understand the reason for using static nested classes in general Jun 08 23:55:39 I looked at suns doc on it, but it didn't provide anything useful Jun 08 23:56:01 a static inner class would be used over a nested class to avoid leak potential, to allow the inner class to have its own life cycle independent of the outer class, and to better encapsulate logic. Jun 08 23:56:45 ^-^ Jun 08 23:56:48 I'm tying to get my subActivity to return a String array to my primary activity. I set the put the data in the intent of the subActivity using putExtra(), but when onActivityResult is called in my primary activity, the Intent turns up null Jun 08 23:56:53 but when the latter two are not necessary, and the former can be mitigated otherwise, non-static nested classes are sometimes easier to work with. Jun 08 23:57:01 what intent is sent to the onActivityResult call? Jun 08 23:57:07 especially when cooperation is required wiht hte parent class Jun 08 23:57:24 hey guys, i am trying to obtain an rss file and print out all its contents - however my code seems to stop after the first set of lines - this is the method : http://pastebin.com/m5e349272 and this is the rss file : 06-09 00:49:31.117: http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/teams/d/dundee/rss.xml Jun 08 23:57:29 in general, static inner classes are your best first choice. Jun 08 23:57:58 ok, I guess I just need to read up on it more Jun 08 23:58:17 herriojr: the core difference is that a non-static inner class implicitly holds a reference to its parent and therefore cannot be instantiated outside of the context of the parent class Jun 08 23:58:35 jasta: got it Jun 08 23:58:44 ^_^ Jun 08 23:59:02 a static inner class is otherwise the same as a class in a separate file Jun 08 23:59:17 which gaurantees some sane level of encapsulation Jun 08 23:59:31 ok Jun 08 23:59:42 hello anybody Jun 08 23:59:44 renegadeandy: u want something more like this i think Jun 08 23:59:45 http://pastebin.com/d69c4539e Jun 08 23:59:49 hey chouman82 Jun 09 00:00:04 hmm Jun 09 00:00:06 lemme try that Jun 09 00:00:07 one sec Jun 09 00:00:39 so, in general, I should try to use static inner classes over inner classes, just to have the same interface as if it were a separate file Jun 09 00:01:27 chouman82 that still stops at the same stage Jun 09 00:01:29 it gets this far Jun 09 00:02:47 as to minimize leakage potential as you put it Jun 09 00:03:06 and if it needs to be separated into another file later on, it's really easy Jun 09 00:03:10 ah Jun 09 00:03:11 shi Jun 09 00:03:11 from wat i see, the rss has everything on one line Jun 09 00:03:15 no the problem is Jun 09 00:03:19 yeah - just thought about that Jun 09 00:03:23 how should i parse that Jun 09 00:03:35 use xmlparser Jun 09 00:03:43 HATE xml parsing Jun 09 00:03:59 cnt seem to get it working under android Jun 09 00:04:02 u got any examples Jun 09 00:09:27 chouman82 Jun 09 00:09:29 this is what i have so far Jun 09 00:09:38 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); Jun 09 00:09:39 DocumentBuilder db = dbf.newDocumentBuilder(); Jun 09 00:09:39 Jun 09 00:09:39 Document doc = db.parse(urlConn.getInputStream()); Jun 09 00:09:46 but i dont see how i navigate the tree from this point Jun 09 00:10:41 oh Jun 09 00:10:54 i would just take the inputstream and directly parse it Jun 09 00:11:37 from the doc Jun 09 00:11:38 ? Jun 09 00:12:43 like Jun 09 00:12:52 doc.getElementsByTagName("item") Jun 09 00:12:52 ? Jun 09 00:14:52 something like this http://pastebin.com/m5d59748a Jun 09 00:16:13 god thats horrible Jun 09 00:16:15 cnt read that! Jun 09 00:16:47 ? Jun 09 00:19:38 whast wrong with something like this http://pastebin.com/mb5208d Jun 09 00:23:32 u can def do that Jun 09 00:23:37 i was telling u how i did it Jun 09 00:23:43 thats all Jun 09 00:24:31 ahh i see Jun 09 00:24:39 why would u do it your way, as opposed to mine? Jun 09 00:28:49 guys - is there any graphical way to browse the contents of the sqlitedatabse i am using in my application Jun 09 00:38:12 .,.,. Jun 09 00:41:01 Can anybody give me an example use of the scrollview Jun 09 00:46:03 .. Jun 09 00:50:19 anyone? Jun 09 00:51:05 Can anybody give me an example use of the scrollview Jun 09 00:57:32 guys Jun 09 00:57:40 can somebody help me with asynctask Jun 09 00:57:43 its a simple question Jun 09 01:04:35 hey guys Jun 09 01:04:38 anyone still awake Jun 09 01:04:39 I need a hand Jun 09 01:06:07 is it possible to change the font in a ListView? Jun 09 01:07:07 im unsure Jun 09 01:07:09 im sure it is Jun 09 01:07:17 mate - do you know how to make a new TextView object in code Jun 09 01:07:22 like if im populating a scrollview Jun 09 01:07:24 with textview children Jun 09 01:09:11 .. Jun 09 01:12:19 .,., Jun 09 01:15:09 i just notice that android sdk is only for i386 but not 64. i am trying to run standalone ddms and it complains about architecture. i check the web and find no amd64, can someone confirm that for me pls ? Jun 09 01:16:01 if u r developing on 64bit linux and need to use stand alone ddms, how do you use it? thx. Jun 09 01:19:11 don't know how much differences are between standalone and plugin for ddms. (i have never used logcat plugin anymore but standalone in console cause logcat plugin just freeze the computer. ) Jun 09 01:20:04 the eclipse is not letting me attach sources to the android.jar.....any ideas? Jun 09 01:20:41 hunterp: you cant use the ADT plugin if you want to attach the source like that. Jun 09 01:20:59 i just usually open the source as a separate project and use CTRL+SHIFT+T to jump to source files in it Jun 09 01:21:26 sigh :-( Jun 09 01:21:33 and then i often just run the version i built, so i can debug against it if i need to using that source Jun 09 01:22:15 its not really that much work Jun 09 01:22:22 i have instructions up on my blog on how to do some of this junk Jun 09 01:24:34 hey guys Jun 09 01:24:38 im tryna use a scrollview Jun 09 01:24:43 as i see it thye support only one child Jun 09 01:24:52 so can i use a listview as the child to display a list of items!? Jun 09 01:25:20 ugh Jun 09 01:25:29 why cant you just use a ListView wihout a ScrollView? what is the matter with you? Jun 09 01:25:43 ...what if there is more items than fit on the screen? Jun 09 01:25:55 jasta im learning,,, Jun 09 01:26:22 renegadeandy: ListView handles more items than can be displayed on screen Jun 09 01:26:30 go read through ApiDemos. Jun 09 01:26:42 renegadeandy: "Class Overview Jun 09 01:26:42 A view that shows items in a vertically scrolling list. The items come from the ListAdapter associated with this view. Jun 09 01:26:42 " Jun 09 01:26:52 from http://developer.android.com/reference/android/widget/ListView.html Jun 09 01:27:00 the keyword here is "scrolling" Jun 09 01:28:00 renegadeandy: the API references are really quite good for android. use them :) Jun 09 01:28:27 yeah - i tend to find them so inaccesible, trying to fish through the code - the xml bits etc Jun 09 01:29:19 so i use addFooterView(View v) Jun 09 01:29:20 renegadeandy: seriously, the API is well documented. In this case, searching for "listview" would have given you the above lines. Jun 09 01:29:24 where v is my new textviews Jun 09 01:31:18 hmm - http://pastebin.com/m69e9b0d5 this is what im doing, it doesnt crash but it doesnt show anything on screen either Jun 09 01:32:41 :'( Jun 09 01:34:00 sammyF? Jun 09 01:37:16 renegadeandy: no idea. I seldom have anything to do with anything but linear view and the occasional gridview Jun 09 01:37:24 I write games, not ~serious~ applications :) Jun 09 01:37:28 :'( Jun 09 01:37:34 i duno what would be wrong Jun 09 01:37:44 no crash Jun 09 01:37:54 but no visible signs of anything from the view on screen Jun 09 01:40:00 ahhhhhhhhhhhhhh somebody please help me Jun 09 01:43:36 did you try tracing it to see how your listview looks like when you exit the loop? Jun 09 01:44:04 thts the thing Jun 09 01:44:08 the listview is invisible Jun 09 01:44:09 cnt see it Jun 09 01:44:17 blidnly fishing here... as I said : never had anything to do with listviews Jun 09 01:45:14 ooooooo Jun 09 01:45:15 if you set a breakpoint at ArrayList and run the code in debug mode, you should be able to see the content of sportsStoryResults on each iteration Jun 09 01:45:16 fixed it Jun 09 01:45:29 haha fucking hell i feel like i have achieved something Jun 09 01:45:31 guess how i did it Jun 09 01:45:39 no?! Jun 09 01:45:44 second result Jun 09 01:45:45 http://developer.android.com/search.html#q=listview Jun 09 01:45:50 i did a bit of api digging Jun 09 01:45:51 => Jun 09 01:54:38 Hi, Jun 09 01:54:47 how can I create an intent to send an SMS Jun 09 01:54:50 I tried the following: Jun 09 01:54:52 Intent sendIntent = new Intent(Intent.ACTION_VIEW); Jun 09 01:54:52 sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); Jun 09 01:54:53 sendIntent.setType("vnd.android-dir/mms-sms"); Jun 09 01:55:03 but how to specify the receipent? Jun 09 01:55:28 lucius, I believe you need to use ACTION_SENDTO Jun 09 01:55:40 okay. Jun 09 01:55:46 can anybody help me create a onclicklistener for my listview to determine which item was clicked? Jun 09 01:56:17 but how to specify the recipient? Jun 09 01:56:29 renegadeandy, it's in the ListView docs (perhaps AbsListView) Jun 09 01:56:52 lucius, I don't remember offhand; look through the Mms application source Jun 09 01:59:30 okay. I have searched in eclipse. MMS does not use Intent.ACTION_SENDTO Jun 09 01:59:36 only Jun 09 01:59:44 com.android.im.app.ImUrlActivity Jun 09 01:59:48 uses it Jun 09 02:00:06 but it does not add 'recipent' Jun 09 02:00:08 lucius, you can use sms:18004664411 notation, IIRC Jun 09 02:00:50 where/how to use this notation? Jun 09 02:00:58 what to put that in the intent? Jun 09 02:01:00 KNY looking thru the docs i cannot see an example listener anywhere ofr listview Jun 09 02:02:18 renegadeandy, then you're looking in the wrong place. Are you using a ListActivity or a ListView? Jun 09 02:02:24 lucius, setData() Jun 09 02:02:26 listview Jun 09 02:02:50 ok Jun 09 02:02:56 thx KNY Jun 09 02:03:01 lucius: I think you just want http://developer.android.com/reference/android/telephony/gsm/SmsManager.html Jun 09 02:03:04 renegadeandy, and you looked through this page? http://developer.android.com/reference/android/widget/ListView.html Jun 09 02:03:57 KNY, can you please tell me if it is possible to create an Intent to IM (not sms) someone? Jun 09 02:04:27 lucius, I haven't the foggiest idea Jun 09 02:04:38 get ddms working for 64 linux Jun 09 02:04:38 http://tinyurl.com/mk6qoq Jun 09 02:04:38 -- Installed the ia32-java-6-sun package, which is a 32-bit JRE that runs under 64-bit Linux Jun 09 02:04:38 -- Copied tools/ddms to tools/ddms64 Jun 09 02:04:38 -- Modified line 72 of tools/ddms64 to read: Jun 09 02:04:38 java_cmd="/usr/lib/jvm/ia32-java-6-sun/bin/java" Jun 09 02:08:58 renegadeandy, have you looked through the apidemos sample application? I'm sure that they have a sample of it somewhere Jun 09 02:10:55 i thnk i found what i want Jun 09 02:11:00 an OnItemSelectedListener Jun 09 02:11:07 however it doesnt appear to be working for me Jun 09 02:11:24 renegadeandy, then you're doing something wrong Jun 09 02:11:35 yeah Jun 09 02:11:56 http://pastebin.com/m2b90cce4 Jun 09 02:11:59 i see no log messages Jun 09 02:13:36 renegadeandy, in the future, it's much easier if you select the "Java" highlighting Jun 09 02:13:51 sure - apologies Jun 09 02:15:53 anything obvious? Jun 09 02:16:24 renegadeandy, all your static stuff makes me suspicious but I didn't really look very closely Jun 09 02:17:42 its static beacuse showScores() is called on postexecute of a asynctask and i didnt know how to return back to the UI thread Jun 09 02:17:46 so had to make a static method Jun 09 02:17:50 which accssed it that way Jun 09 02:17:55 seems to work Jun 09 02:17:59 the list populates etc Jun 09 02:20:23 ahaaa Jun 09 02:20:24 got it Jun 09 02:28:36 gah Jun 09 02:28:40 having issues with webviews now Jun 09 02:28:57 i add one to my main.xml, visible = false Jun 09 02:29:00 yet it always appears Jun 09 02:29:02 cnt ignor eit Jun 09 02:30:23 even when setenabled = false and setvisible = 0 Jun 09 02:30:26 it still appears Jun 09 02:30:30 wtf is that about Jun 09 02:30:48 wtf is with you not reading the docs is the better question Jun 09 02:31:05 read up on android:visibility (or setVisibility) Jun 09 02:33:16 lol.... Jun 09 02:33:25 so its meant to be setvisible(4) to make it invisible Jun 09 02:33:27 how fuckin dumb is that Jun 09 02:33:37 no, it's setVisibility(View.GONE) Jun 09 02:33:56 renegadeandy, this isn't #android-tutors Jun 09 02:34:06 please go through the notepad tutorial Jun 09 02:35:09 ok, thank you for your continued support - i am just stupidly tired Jun 09 02:35:12 3.31 am here Jun 09 02:35:16 should go to bed cnt think this late Jun 09 02:35:23 yikes. yes indeed. ;) Jun 09 02:35:32 * ctate pumpkins around 1am these days Jun 09 02:35:52 ctate, I've been trying to get my sleep schedule back to ~midnight from ~3am Jun 09 02:36:06 melatonin FTW Jun 09 02:36:09 but just as I start to make headway, something urgent comes up and I have to pull a long night :( Jun 09 02:36:23 yea this is just making me angry cos i am so determined to get something to work Jun 09 02:36:29 and sit there for hours working it ot Jun 09 02:36:32 ctate, well, I'm an unemployed college student taking summer classes; I almost never have to be up before noon :) Jun 09 02:36:43 I just graduated Jun 09 02:36:45 => Jun 09 02:36:53 well, will officially in about 3 weeks Jun 09 02:36:53 KNY: o the hardships we endure Jun 09 02:36:56 renegadeandy, things go faster if you read the docs *first* instead of just hacking away :) Jun 09 02:36:58 * ctate . o O ( bastard ) Jun 09 02:37:04 ctate, amen, such a tough life I lead :) Jun 09 02:37:12 KNY i know they do mate - i am an experianced Java coder and just dive in at the deep end Jun 09 02:37:14 its stupid Jun 09 02:37:17 heh Jun 09 02:37:23 but i do it anyway Jun 09 02:38:08 ctate, of course, you get paid to get up whenever it is that you get up whereas I don't, haha Jun 09 02:38:22 true Jun 09 02:38:35 OTOH you never have to work on weekends, i bet. Jun 09 02:38:41 which is not unheard of in my life. Jun 09 02:38:54 OTOOH, you don't get to eat at Pintxo. ;) Jun 09 02:38:56 I did on my last internship Jun 09 02:39:09 of course, since I was hourly, I got time and a half, which was sweet Jun 09 02:39:46 I did extreme blue UK with IBM last summer Jun 09 02:39:49 was incredible Jun 09 02:40:46 ctate, I generally have no idea what day it is. I woke up sunday morning and hit the "home" button on my phone to check the time. It shows the time next alarm is, which said "Mon 9:30am" and I freaked because I thought I had missed class (it was noon on sunday) Jun 09 02:40:47 heh Jun 09 02:40:54 so yeah, I "work" weekends Jun 09 02:41:01 KNY: ha ha Jun 09 02:41:19 right, night gents, cheers again KNY Jun 09 02:41:43 perhaps someone should revise the lock screen to help with us in groggy just-awakened states :) Jun 09 02:42:19 that's what the alarm clock is for Jun 09 02:42:27 ctate: i prefer klaxon. Jun 09 02:42:28 also, caffeine Jun 09 02:42:40 unix_lappy: aWOOOga? Jun 09 02:42:43 I don't do the caffeine thing Jun 09 02:42:51 I can't stand how it makes me feel Jun 09 02:43:09 my wife loves it and it affects her like meth affects normal people Jun 09 02:43:19 so she can't drink it, and is hugely bummed about that Jun 09 02:43:24 haha Jun 09 02:43:32 anyone know of some relatively mature android on netbook projects? Jun 09 02:43:33 she gets all itchy and feels like she has bugs in her skin? Jun 09 02:43:42 or android on x86 projects? Jun 09 02:43:43 an hour of euphoria, then strung out and miserable for a day and a half Jun 09 02:43:46 unix_lappy, wasn't there eeedroid or something? Jun 09 02:43:51 ctate, haha Jun 09 02:44:17 speaking of which, the last episode of Breaking Bad was last week which I'm bummed about Jun 09 02:44:21 KNY: heh, i'm guessing the use of the word something mean it isnt properly mature. Jun 09 02:44:25 last episode of season 2, anyway Jun 09 02:44:38 KNY: she can't even drink decaf. it makes her hyper. Jun 09 02:44:45 unix_lappy, I just don't remember if it's the exact name Jun 09 02:44:51 ctate, damn, that's rough Jun 09 02:45:04 well, kind of. I can't stand the smell of coffee, so that helps haha Jun 09 02:45:07 yeah, she's ticked about the unfairness of it all. Jun 09 02:45:08 heh Jun 09 02:45:26 just tell her that "it all comes out even the day you die" Jun 09 02:45:36 that's why my mom used to tell me when I was growing up Jun 09 02:45:48 and that's why you turned out like this? Jun 09 02:45:49 ;) Jun 09 02:46:20 hey, I had three older sisters and we fought constantly; I think she was secretly hoping that things would come out even sooner rather than later, so to speak ;) Jun 09 02:46:25 ha ha Jun 09 02:46:51 err, have* since I still have them **** ENDING LOGGING AT Tue Jun 09 02:59:57 2009