**** BEGIN LOGGING AT Sun Apr 07 02:59:58 2013 Apr 07 03:00:03 hesperaux: yeah, once the run function returns, its dead Apr 07 03:00:20 hesperaux: Looper.loop(); will wait for events to come in and process them, forever (until quit is called) Apr 07 03:00:29 clever, but i'm instantiating a thread object...not passing in a runnable Apr 07 03:00:37 wouldn't the thread object exist until i nullify it? Apr 07 03:00:40 g00s, lol, if would have kaneda still if i hadnt gone inactive for so long Apr 07 03:01:03 hesperaux: yeah, but the thread itself starts, calls run on the instance, then the thread itself is shutdown Apr 07 03:01:12 leaving a threadless instance of Thread Apr 07 03:01:18 interesting Apr 07 03:01:23 gah Apr 07 03:01:26 found it Apr 07 03:01:29 so run is all that is ever executed, basically Apr 07 03:01:32 that explains a lot Apr 07 03:01:35 yep Apr 07 03:01:42 * hesperaux claps Apr 07 03:01:47 having a Looper and Handler allow you to post many Runnables to it Apr 07 03:01:53 and they get ran one by one Apr 07 03:02:11 it's becoming clearer to me now :) Apr 07 03:02:39 in my app, i wrote the Thread end to be cross-platform, android + windows + mac + linux Apr 07 03:02:44 so i cant use android.os.Looper :( Apr 07 03:02:51 wrote my own clone of it Apr 07 03:03:13 hmm, i see Apr 07 03:03:37 i wrote the entire lib in pure (android-free) java, then i include that lib into the android app Apr 07 03:03:37 theoretical question: if i create a thread and put while(1); in it, does it bog down the cpu, or just keep alive? Apr 07 03:03:43 so the android app is just UI Apr 07 03:03:49 it will eat 100% cpu Apr 07 03:03:59 how does the looper class avoid that problem? Apr 07 03:04:03 and you can wave goodbye to your battery life Apr 07 03:04:45 well i got that working Apr 07 03:05:01 not quite as clean as I hoping for, but doable Apr 07 03:05:03 hesperaux: https://github.com/android/platform_frameworks_base/blob/master/core/java/android/os/Looper.java#L124 Apr 07 03:05:07 looks like it uses some kind of "sync barrier" thing Apr 07 03:05:19 i.e. a refresh rate of some kind? Apr 07 03:05:26 hesperaux: when any function blocks (like queue.next), it will simply stop the thread and wait for something Apr 07 03:05:36 hesperaux: can i see your code? Apr 07 03:05:59 i've just never understood how a thread could block indefinitely and also know when something else happens...without a processor interrupt Apr 07 03:06:24 hesperaux: thats where it helps to know about how scheduling works in linux Apr 07 03:06:25 clever, yeah, sure. You want to see my Thread class? Apr 07 03:06:40 hesperaux: you have 2 things that can trigger a 'context switch', and yes Apr 07 03:07:03 hesperaux: a: pre-emption, a timer has run out (this program is eating too much cpu!) Apr 07 03:07:10 and b: when you give up the processor (your waiting for something) Apr 07 03:07:36 in the case of b, you set a flag on the process to say its not runnable, and then the kernel simply stops returning to the process Apr 07 03:07:43 it effectively locks up, and never gets the cpu Apr 07 03:07:58 hesperaux: i do really recommend reading Java Concurrency In Practice. I'm not trying to shut you up or anything, definitely keep asking questions and clever is giving good information. But I personally avoiding reading that book for much longer than I should have and everything was much clearer after I read it. Even the free sample on Kindle is helpful to get started. Apr 07 03:08:03 what wakes it up, depends on what made it stop Apr 07 03:08:28 interesting Apr 07 03:08:38 kevinb, hmm...well the thing is, I don't know if i want to spend the money on that book right now Apr 07 03:08:43 <--- poor college student Apr 07 03:08:48 if you tried to read from a serial port, then the irq from the serial port will set the state as runnable Apr 07 03:09:03 in this case, your waiting for an event from another thread, so when you add an event, that does it Apr 07 03:09:13 hesperaux: just read the free sample from Amazon Kindle then :P Apr 07 03:09:28 kevinb: i should too, i'm still new to java Apr 07 03:09:38 though ive learned the ins&outs of everything from kernel dev to c++! Apr 07 03:10:03 i'm a perl/c programmer Apr 07 03:10:15 hesperaux: you know pthread? Apr 07 03:10:16 and i do embedded C, which has no fancy scheduling and stuff ;) Apr 07 03:10:37 nope, i've never used C on non-embedded platforms Apr 07 03:10:40 yeah, embeded c doesnt even have processes, much simpler Apr 07 03:10:48 but you can add it once you know the basics Apr 07 03:10:54 simpler and also more annoying lol Apr 07 03:11:03 basicaly, all you do is change the address of the stack pointer Apr 07 03:11:22 oh, that would make sense Apr 07 03:11:25 so if the schedule() function finds another process, changes the stack pointer, and returns Apr 07 03:11:36 it will wind up going to whatever called schedule in that thread Apr 07 03:11:45 when the pointer was saved and everything was frozen Apr 07 03:12:35 part of why threads are so important on Android is because the user interface is single threaded. If you had a command line program and were doing a write to the filesystem that might take 500ms, no one cares that your command line interface stalls for that long. But if you do that on the UI thread in android you can't respond to touch events or make progress in an animation Apr 07 03:13:10 pretty much every gui lib ive seen forces you to make the calls from the main thread Apr 07 03:13:19 its not just android Apr 07 03:13:37 yeah, i guess there was some work on one of the java UIs to be multithreaded but it got too complex and didn't work out that well Apr 07 03:14:10 ive done some messy work with QT, and found out, it doesnt force you to call things from the 'main' thread Apr 07 03:14:23 it forces you to do it from the SAME thread that the central QApplication was made in Apr 07 03:14:42 (i was trying to inject gui code into an app, thru a dll, and couldnt block main, and the qt event loop blocks) Apr 07 03:15:03 but things just didnt work out, cant jam 2 gui libs into the same app! Apr 07 03:15:14 haha Apr 07 03:15:25 the host app was closed source Apr 07 03:15:29 no idea what lib it even used :P Apr 07 03:16:20 lol Apr 07 03:16:30 someday i'll learn GTK+ Apr 07 03:17:09 hesperaux: hmmm, let me dig deeper into looper! Apr 07 03:17:23 oops, i forgot to send you my thread Apr 07 03:17:27 i had it copied to clipboard this whole time Apr 07 03:17:52 http://pastebin.com/psHmrKrJ Apr 07 03:18:20 Thanks to your explanations, I have messaging working now at least. Haven't really done UI->Thread, but Thread->UI works fine Apr 07 03:19:07 hesperaux: first problem Apr 07 03:19:17 hesperaux: everything will basicaly halt at line 112, Looper.loop() Apr 07 03:19:24 so it never connects to bluetooth Apr 07 03:19:56 Looper.loop wont finish until you tell the thread to start shutting down Apr 07 03:20:08 and you dont need super.run on line 132 Apr 07 03:20:52 and why are you making a second thread on line 118? Apr 07 03:21:08 that one connects to the device Apr 07 03:21:29 you should be able to do that in the datathread Apr 07 03:21:49 okay Apr 07 03:25:33 hesperaux: http://pastebin.com/aCs57ANq Apr 07 03:26:03 hesperaux: this shows the path all the way from Looper.loop() in java, to Looper::pollOnce in c++ Apr 07 03:26:08 which leads over into the kernel, via epoll Apr 07 03:27:25 and the rabbit hole doesnt stop here! Apr 07 03:27:33 hehe Apr 07 03:27:45 hesperaux: https://github.com/torvalds/linux/blob/master/fs/eventpoll.c Apr 07 03:28:03 hesperaux: line 1857! Apr 07 03:28:38 hesperaux: and then line 1494 Apr 07 03:28:47 ah Linus, you crazy person Apr 07 03:29:16 hesperaux: and at line 1537, it sets the state to interuptable, which means the kernel wont schedule it anymore Apr 07 03:29:33 as soon as it looses cpu, it will 'never' get it back (enless something changes the state from the outside) Apr 07 03:30:15 and line 1546 does the actual schedule call Apr 07 03:30:29 with some kind of timer built in, havent seen that before Apr 07 03:30:52 so most threads in android should be stuck at line 1546 of this file, waiting for something to wake it up Apr 07 03:31:47 pretty deep stuff Apr 07 03:32:03 hesperaux: and for wakeup, we go back to Looper.cpp, all it does it write a 'W' to a file handle Apr 07 03:32:08 i think this is why i switch to electrical engineering :D Apr 07 03:32:13 epoll is designed to let you know when you have data waiting on any file handle you give it Apr 07 03:32:42 i love tearing stuff appart like this, to see how it works Apr 07 03:32:47 anyone know who to write a Gson deserializer to initialize an object based on its parent? Apr 07 03:33:39 bla nm Apr 07 03:34:43 clever, are you a software engineer? Apr 07 03:35:16 hesperaux: i'm a highschool dropout with only a grade 10 :P Apr 07 03:35:25 nice Apr 07 03:37:51 hesperaux: most of what i know about the kernel is from reading linux device drivers 3 Apr 07 03:38:04 ah, well done Apr 07 03:38:15 after that, you know the basics of how everything works, and can navigate the source with ease Apr 07 03:38:25 personally, i despise reading books - i learn very poorly from them. I need to be able to ask questions Apr 07 03:38:49 heh, i love books Apr 07 03:38:50 when the book gives code examples, i dont even run them on the pc Apr 07 03:38:50 most of my college life has involved not reading the textbook at all Apr 07 03:38:56 * g00s begins reading Lightroom book Apr 07 03:39:03 i run the code examples on my brain! :P Apr 07 03:39:56 i read everything (though a lot more online than actual books), but am bad at asking questions so I just read other people's questions instead ;) Apr 07 03:41:55 g00s: what http client(s) did you recommend again? Apr 07 03:45:09 most people use httpurlconnection i think Apr 07 03:45:20 ok thianks Apr 07 03:47:52 clever, if i create public methods in a Thread, can I execute them with the class object, or are they unreachable? Apr 07 03:51:04 If I want a task to run only once, for instance, download a JSON from a server, what should I use ? Apr 07 03:53:09 doutdes, probably ASyncTask by the sound of it Apr 07 03:53:47 hesperaux: i would do both public and private versions of everything Apr 07 03:53:52 hesperaux: let me pastebin an example Apr 07 03:54:01 doutdes: IntentService would work nicely Apr 07 03:54:31 I didn't explain well, I'm sorry, I want my program to download something every x minutes, I will setup an alarm to call a.. Apr 07 03:54:39 Oh, will check that out g00s, thanks Apr 07 03:54:55 hesperaux: http://pastebin.com/2xdhz6Ep Apr 07 03:55:00 doutdes: well, then you'll use alarmmanager + broadcast receiver + intentservice Apr 07 03:55:13 exactly! Apr 07 03:55:15 hesperaux: the public one gets called from the main thread, and handles all the messy handler stuff Apr 07 03:55:16 thanks Apr 07 03:55:27 hesperaux: the private one then gets ran on the data thread, at a later time Apr 07 03:55:49 but you only need to do that for things that must run on the thread Apr 07 03:57:03 so basically, you're acting on a message without having a Message Apr 07 03:57:11 Are there any themes for Android that people can download? Apr 07 03:57:15 yeah, ive never done any message stuff with handlers Apr 07 03:57:22 ive only used them to run a Runnable on the thread Apr 07 03:57:26 the fact that you're calling public doSomething implies a Message, where what="something" Apr 07 03:58:16 hesperaux: the second method doesnt even need to exist, you can just put that code on line 4 if you wanted to Apr 07 03:58:31 yeah Apr 07 03:58:40 Any of you uses a VIM plugin on eclipse ? Apr 07 04:02:20 hesperaux: hmmm, is the read function for the bluetooth lib async (calls X when there is data) or blocking? Apr 07 04:04:32 hesperaux: ah, its just a bare InputStream Apr 07 04:04:32 pretty sure it's blocking. so i'm gonna have to spawn another thread probably Apr 07 04:04:35 probly blocking then Apr 07 04:04:48 i would just ditch the entire looper then Apr 07 04:04:50 same for writing I think Apr 07 04:05:11 public void run() { connect; while (!quiting) { packet = socket.read(); ... } }; Apr 07 04:05:14 simple Apr 07 04:05:46 when you want it to stop, just set quiting to false and close the socket from outside the thread Apr 07 04:06:03 when the socket is closed, the read function should return an error of some kind Apr 07 04:06:14 i'd have to make the quiting variable thread safe then, right? Apr 07 04:06:34 boolean should be thread safe, it can only have 2 values Apr 07 04:06:42 it can never get stuck with half of it changed Apr 07 04:06:55 heh, good point Apr 07 04:06:59 worst case it cycles one more time Apr 07 04:07:02 clever: well, see AtomicBoolean and "volatile boolean" Apr 07 04:07:05 XD Apr 07 04:07:18 g00s: *looks* Apr 07 04:07:24 isnt volatile a c thing? Apr 07 04:07:38 * hesperaux recognizes it Apr 07 04:07:39 hesperaux: nows a good time to check out JCIP XD Apr 07 04:07:55 g00s: the only bonus i can see for AtomicBoolean, is the compare+set tools Apr 07 04:08:05 it tells the compiler not to optimize out the reference because the pointer contains data that may be changed outside execution Apr 07 04:08:05 but if the thread only ever reads it, i dont see a need Apr 07 04:08:08 its a better "volatile boolean" Apr 07 04:08:19 if you have one thread read, one write it - it needs to be volatile Apr 07 04:08:24 hesperaux: yep, but i didnt think java had that Apr 07 04:08:36 java has volatile Apr 07 04:08:38 neither did i Apr 07 04:08:39 ah Apr 07 04:08:58 it's used to say that one thread can expect to get differing values of a var, essentially Apr 07 04:09:03 ive only used it for passing things out of an irq in avr's Apr 07 04:10:51 hesperaux: once you deal with the reads, is there any need for another thread? Apr 07 04:11:23 let me explain what i planned to do: Apr 07 04:12:49 115200bps data stream comes over bluetooth. I want to capture every single byte of that stream. The data will have a sequence code to check for missing entries (it's real-time data). I want to process that data, as well as store it (implementing later), then make it available to the service in the thread's state. I also (implementing later) want to send bytes over the bluetooth connection to configure the module itself as well as my microcontroll Apr 07 04:12:49 er. Apr 07 04:13:27 hesperaux: all of the processing can be done within the read thread, in a blocking manner Apr 07 04:13:44 and stored in local fields on the service instance Apr 07 04:14:24 Oh, btw, i figured that i'd store the data at the input rate, but the UI would update from storage on a timer Apr 07 04:14:39 pass a reference to the service when you create the thread, and tell the socket to disconnect (killing the thread) in onDestroy Apr 07 04:15:03 and updating the ui from a timer will just waste cpu Apr 07 04:15:19 parse everything out into simple objects, and then post a runnable to the ui thread to update things Apr 07 04:15:20 * hesperaux explodes Apr 07 04:15:52 i can't post a runnable with access to the ui unless i do your interface trick, which i don't want to learn right now Apr 07 04:16:05 i can send objects through the Message though Apr 07 04:16:22 so I thought I would send a Message with a simple object for the UI to update Apr 07 04:16:32 runonuithread(new runnable(.... Apr 07 04:16:58 or use an asynctask, the postexecute method runs in the calling thread, typically the ui thread Apr 07 04:17:03 kaneda^: it still wouldnt have a reference to the activity currently on the screen Apr 07 04:17:08 kaneda^: the data is coming from a service Apr 07 04:17:37 GUI -> Service -> Thread Apr 07 04:18:03 to get data in the other direction, the service needs a reference to the current Activity Apr 07 04:18:24 or a handler from that context, which is what i was gonna do Apr 07 04:18:32 you might want to write some sort of singleton controller Apr 07 04:18:36 send small objects up through the message queue Apr 07 04:18:39 then while the app is open use taht to communicate Apr 07 04:18:44 kaneda^: thats what the service is for Apr 07 04:18:47 ah Apr 07 04:18:52 yes Apr 07 04:19:03 hesperaux: thats the same thing, just a different way to do it Apr 07 04:20:03 hesperaux: http://pastebin.com/Cp89BBvH Apr 07 04:20:05 hesperaux: this is a piece of my service code Apr 07 04:20:27 setCallback gets called after binding the service, unsetCallback before i unbind it Apr 07 04:20:37 all activitys implement Callbacks Apr 07 04:21:03 so now i can simply do this if i want to update the ui, if (cb != null) cb.loginDone(); Apr 07 04:23:25 hesperaux: you still need to do the same thing if you wanted to use a Handler, thats about the only way to know which Handler to post to Apr 07 04:31:53 anyone tried coding client/server communications with an android device over usb? Apr 07 04:33:11 googling around for a solution, so far havent found one Apr 07 04:34:32 special accessory mode api interface looks more like its for connecting periphereals than to have 2-way communication with a pc Apr 07 04:35:22 AnTi_MTtr: yeah, its meant to connect to host mode accessories, but there are demo programs using libusb to do it from linux Apr 07 04:35:38 and theres nothing stopping you from abusing it to make a whole desktop into an accessory Apr 07 04:35:41 aslong as it has cross platform api support Apr 07 04:35:50 im looking to build a windows based server app Apr 07 04:35:52 i'm pretty sure libusb also works on windows Apr 07 04:35:56 w/an android client Apr 07 04:36:20 and would prefer usb2 in case i want to push data fast/or without an internet connection Apr 07 04:36:49 so in that case i'd use the accessory mode api's Apr 07 04:36:52 from what you're telling me Apr 07 04:36:55 i think this shows how to do it from libusb http://stackoverflow.com/questions/6524891/android-adk-with-pc-as-usb-host-with-libusb-bulk-transfer-error Apr 07 04:37:35 http://www.libusb.org/wiki/windows_backend and it seems libusb does have windows versions Apr 07 04:38:18 * do0ob wonders how long it takes to pull android build files Apr 07 04:38:20 great info, thanks Apr 07 04:38:53 AnTi_MTtr: the accessory protocol also includes stuff to put an app store link, and app name Apr 07 04:39:04 so if the android doesnt have your app, the user can install it easily Apr 07 04:39:55 i was going to use it on my kindle fire, but amazon neutered all of the accessory protocol stuff Apr 07 04:40:09 ahh lame Apr 07 04:40:28 they have also (just recently) done some broken code in systemui Apr 07 04:40:44 it expects the wifi icon to always be there, and it seems the gsf (for gcm) hides the icon Apr 07 04:40:49 null pointer exception! Apr 07 04:41:02 ya im thinking about building an app to act as kind of a user controlable billboard, so the table would be the display for the board, and the pc would have a windows app runing where the user could control whats being displayed Apr 07 04:41:05 status bar dies, rotation dies, no way to open notifications Apr 07 04:41:28 AnTi_MTtr: another way to do it, without usb, just use tcp Apr 07 04:41:30 or even udp Apr 07 04:41:35 so its oging to involve realtime communication and maybe streaming, or i might just do it all by rpc and store the animations/video localy Apr 07 04:41:41 send a broadcast packet with scores to the entire network Apr 07 04:41:49 any active tablet on the network could show it Apr 07 04:41:51 ya the problem with that is the enviroments i'd use it in dont neccisssarily have good internet Apr 07 04:42:03 local wifi is a possibliity Apr 07 04:42:04 doesnt need internet access, just local network Apr 07 04:42:16 but i'd prefer usb since i have some flakey wifi adapters Apr 07 04:42:24 well i should make it so it works either way Apr 07 04:42:24 it would also let you hang a dozen tablets all over the room, on different walls Apr 07 04:42:28 and all update together Apr 07 04:42:33 but im just thinking about my own personal application Apr 07 04:42:48 clever: that would be kinda awesome Apr 07 04:43:33 if i get serious developing this ill have excuse to buy a tablet Apr 07 04:43:34 finaly Apr 07 04:43:51 could always borrow androids from the players :P Apr 07 04:44:09 every player connect to the wifi and install your app, then duct-tape their phone to a nearby wall Apr 07 04:44:16 or just hold it :P Apr 07 04:44:19 ya, i have an android phone but its like a first gen galaxy with ancient firmware so its useless for developing Apr 07 04:45:38 with all the usb support i should be able to figure most of it out this summer Apr 07 04:45:54 im already using large lcds to enhance the game Apr 07 04:46:14 but integrating tablets for realtime updates is taking it to the next level Apr 07 04:52:22 AnTi_MTtr: hmmm, where did i leave my code... Apr 07 04:54:17 clever: you use eclipse? Apr 07 04:54:28 that program was before i began using eclipse Apr 07 04:54:30 ive used eclipse for java before and like it Apr 07 04:54:40 android sdk is java right? Apr 07 04:54:44 yeah Apr 07 04:55:13 are the emulators capable of emulating usb communication? Apr 07 04:55:18 nope Apr 07 04:55:20 or would i need to get a device to test my code Apr 07 04:55:34 need a real device to test usb stuff Apr 07 04:55:44 gotcha Apr 07 04:59:05 cant seem to find the accessory code i was using, anywhere Apr 07 04:59:34 nice libusb has a freenode channel Apr 07 05:00:25 clever: you think most of the cheapy tablets sub $200 would have usb ports? Apr 07 05:00:30 or is that a high end feature Apr 07 05:00:50 id think they all have micro-usb now a days Apr 07 05:01:03 slave only most of the time Apr 07 05:01:27 so the 'accessory' will need to be host most (desktop is always host) Apr 07 05:02:14 ahh Apr 07 05:02:35 so connecting things to a desktop will be simple Apr 07 05:02:55 ya, simple two way communication is what i need Apr 07 05:03:06 send rpc calls through that Apr 07 05:03:32 i guess it could even be asynchronis now that i think about it Apr 07 05:03:38 Does the IntentService runs at the same thread as the main thread ? Apr 07 05:03:42 Do Apr 07 05:03:45 * Apr 07 05:03:50 run* Apr 07 05:04:00 doutdes: no, thats the point Apr 07 05:04:12 thanks Apr 07 05:19:38 AnTi_MTtr: ah, found it Apr 07 05:19:45 AnTi_MTtr: a bare c file in my downloads folder! Apr 07 05:20:42 AnTi_MTtr: this is what i was using to test things http://gallery.earthtools.ca/download/simplectrl.c Apr 07 05:21:03 i had to mess with the vid/pid at the top to make it even react Apr 07 05:27:35 AnTi_MTtr: ah, http://android.serverbox.ch/?p=262 Apr 07 05:30:24 AnTi_MTtr: http://android.serverbox.ch/?p=370 Apr 07 05:32:04 ah, one of those is for the other way around Apr 07 06:04:42 Is there any good SQLite library ? Apr 07 06:04:44 anyone know if the android azure mobile services sdk supports offline caching on device? Apr 07 06:05:12 Y would u need a library for sqlite Apr 07 06:06:57 I don't need it, it would just make the code cleaner Apr 07 06:32:27 doutdes ormlite might be what your looking for Apr 07 06:33:11 anyone have experience with framework-res.apk or apks in general? Apr 07 06:34:15 Wrong chan Apr 07 06:39:27 How can I send data from my intentService to the main activity when it finishes running ? Apr 07 06:39:47 jug6_mbl: thanks Apr 07 06:51:02 Newb question: what is R in this: R.layout.activity_main Just getting my first hello world app up... Apr 07 06:53:34 a generated file with integers that represent everything in the res/ folder Apr 07 06:57:00 JakeWharton: hm... Apr 07 07:05:00 Hello, I need to change the properties of some elements inside a ListView. Should I get the Adapter , then get the view with the method getView() and after that find the element? Apr 07 07:07:13 no Apr 07 07:07:26 change it when getView is called inside the adapter for that position Apr 07 07:08:45 that seems more weird than just simply changing the value in the adapter and notifying data set changed Apr 07 07:09:56 changing it when getview is called in the adapter means you might have a view that never scrolls off and therefore never refreshes Apr 07 07:10:33 well it's the correct way Apr 07 07:10:36 weird or not Apr 07 07:11:08 then you have some views that might not getView() for a while Apr 07 07:11:25 (which are already visible and should be updated) Apr 07 07:11:34 wat? Apr 07 07:11:58 oh, Browser, are you saying you want to update the data that's displayed on already existing views? Apr 07 07:12:36 it's really hard to pay attention in this channel... Apr 07 07:14:07 I just keep a reference to the List (ArrayList, LinkedList, etc) that is used by the ListAdapter, and I just work with that List and call adapter.notifyDataSetChanged() afterwards Apr 07 07:15:29 that's what "change the properties of some elements inside a ListView" sounds like to me, anyway Apr 07 07:15:42 yeah me too Apr 07 07:15:55 i only half read the question and assumed he wanted to change some views based on properties or something Apr 07 07:16:56 If I declare a broadcast receiver in onResume(), do I need to declare it on onStart()? Apr 07 07:17:28 no Apr 07 07:17:55 Thanks Apr 07 07:24:58 which IDE do you use? and which is best? eclipes, intellij, netbeans, anjuta, ...? Apr 07 07:25:06 i use eclipse at the moment Apr 07 07:25:43 I've found IntelliJ IDEA to be quite superior to Eclipse in every aspect Apr 07 07:26:16 I'm a little confused how @Produce works with Otto Apr 07 07:26:28 Does the bus identify this method returns a class type of Blah and then caches that? Apr 07 07:26:35 no Apr 07 07:26:50 from the website: Apr 07 07:26:50 When registering, the producer method will be called once for each subscriber previously registered for the same type. The producer method will also be called once for each new method that subscribes to an event of the same type. Apr 07 07:27:58 I'm just uncertain how this annotation is used. I understand the @Subscribe annotation, basically tells the bus what methods should be invoked upon the post of data Apr 07 07:28:22 in the example there's BusProvider.getInstance().post(produceLocationEvent()); Apr 07 07:28:30 an explicit call to the produce method Apr 07 07:28:48 right. because it's just a method Apr 07 07:29:02 Oh so during the register invocation, these methods are triggered Apr 07 07:29:04 it's used by the bus to produce events of that type for new subscribers Apr 07 07:29:08 JakeWharton yes, that is, I want to update that elements Apr 07 07:29:41 Okay so when a class is registered listening for LocationChangeEvent, during the register this method is triggered. Apr 07 07:29:59 Okay that makes sense. It's used to invoke the producer methods upon registeration of objects Apr 07 07:30:53 we should probably remove the explicit use of the method to not cause confusion Apr 07 07:32:01 That's what was throwing me off since I'm seeing the method invocation in the example then I'm trying to tie things together mentally. "Does the bus look at the return types and then do caching? That doesn't make sense since this example has an explicit call" Apr 07 07:34:06 Okay so this will be useful. I'll have my Retrofit callback singleton cache state from the prior invocation so when the ConversationListActivity is rendered, it can hydrate the prior cache version and if it's been x amount of time, make a remote server call to refresh the data. Apr 07 07:34:43 Have you guys introduced the GSON serializer for Tape? Apr 07 07:35:31 what do you mean introduced? Apr 07 07:35:45 we've used one for like 2 years Apr 07 07:36:14 Oh I thought you mentioned you guys were going to add it Apr 07 07:36:15 hmm Apr 07 07:36:22 oh right Apr 07 07:36:28 to the actual library Apr 07 07:36:34 it's like 30 lines of code and listed on the website Apr 07 07:36:40 well, a form of it is Apr 07 07:37:12 I was going to implement it but didn't want to duplicate what you guys were going to add. Apr 07 07:37:15 Right now using SerializedConverter Apr 07 07:37:23 yeah. don't use that Apr 07 07:37:37 Serializable is the fucking devil Apr 07 07:37:39 pragma-: you mean, get the adapter, change the propertie and then notify it? Apr 07 07:37:42 java.io.Serialize is a old bag of shit Apr 07 07:37:44 yup Apr 07 07:38:01 Using that now until the GSON stuff is introduced (Still in development so no big deal) Apr 07 07:41:14 Does Otto work with collections? Or should the return type be a base class with the collecion embedded. I think the latter Apr 07 07:41:28 use a concrete class Apr 07 07:41:40 class FooList extends List {} Apr 07 07:42:02 I'm just modeling stuff now as XyzEvent with getters for the state Apr 07 07:42:19 oh Apr 07 07:42:25 yeah the list should be inside the event Apr 07 07:42:29 and events should be immutable Apr 07 07:42:40 Yup immutabity ;) Apr 07 07:42:54 Most engineers don't value functional programming concepts sadly. Apr 07 07:43:21 How can I pause an alarmmanager on onPause() ? Apr 07 07:43:23 I have a blog posting I need to release on using TaskQueue to build more realiable mobile applications and one of the things I mention is making sure tasks are idempotent Apr 07 07:44:00 I explain the reason behind it so they're informed. e.g., you may have a failure in the system or device may shut down causing the task to retry again Apr 07 07:49:55 If I need to run an IntentService every 5 minutes but only when the application is opened is alarm manager a bad choice ? Apr 07 07:50:26 whats everyones favorite ide for developing android apps in java Apr 07 07:51:00 vim Apr 07 07:51:32 neverheard of vim Apr 07 07:51:41 where can i take a look at it Apr 07 07:51:58 Intellij Apr 07 07:52:21 Use vim if you want to measure your pennis ;) Apr 07 07:52:23 yer thats the one i wanted to check out rburton- Apr 07 07:52:28 couldnt remember the name of it Apr 07 07:52:31 lol Apr 07 07:52:42 last I checked VIM wasn't an IDE ;) Apr 07 07:53:00 eclim* Apr 07 07:53:23 VIM can't compare to Intellij. There's nothing to compare Apr 07 07:53:35 there is no reason to compare Apr 07 07:53:40 I'm just more used to vim Apr 07 07:53:53 Hello, I need to change the properties of some elements inside a ListView. Should I get the Adapter , then get the view with the method getView() and after that find the element? I have some images in different rows, So I have to find a image with a specificic tag and change its alpha Apr 07 07:53:54 I use vim a lot, I wouldn't recommend it for programming on an Android project Apr 07 07:54:16 why not ? you can get the completion using eclim Apr 07 07:54:29 completion isn't the feature I'm worried about. Apr 07 07:54:33 what is Apr 07 07:54:39 Debugging Apr 07 07:54:41 i was hardcore vim before i did android development. but with android an actual IDE really makes sense. eclim didn't cut it for me Apr 07 07:55:25 Yea, I just started programming for android so Apr 07 07:55:32 Browser might want to consider notifyDataSetChanged(); Apr 07 07:55:43 Using eclipse was wierd Apr 07 07:55:45 Sounds like you want to update the collection and render the changes Apr 07 07:56:14 rburton-: is just change the property of that image Apr 07 07:56:15 Eclipse isn't bad, but Intellij in my opinion is very nice in comparsion. Just a more polished (experience, features, etc) IDE Apr 07 07:56:42 Browser just changing the tag? you can get the view that the ImageView is a part of Apr 07 07:56:50 Oh, it has an UI designer inside of it Apr 07 07:56:54 will check that out Apr 07 07:57:05 It has that as well. Pretty decent for general stuff Apr 07 07:57:05 rburton-: with getView() ? Apr 07 07:57:29 is the free version complete ? Apr 07 07:57:38 Not complete but has a lot Apr 07 07:57:38 what version do you use rburton- Apr 07 07:57:43 the paid or free Apr 07 07:57:45 Commerical version Apr 07 07:57:46 Intellij Apr 07 07:57:46 rburton-: I want to change just the alpha Apr 07 07:57:51 nice Apr 07 07:57:53 will check if my university has a license Apr 07 07:58:00 Browser from where? Apr 07 07:58:06 doutdes you can get a discount version Apr 07 07:58:17 rburton-: from the main Activity Apr 07 07:58:24 how much did you pay rburton- Apr 07 07:58:28 Browser what triggers it? Apr 07 07:58:28 199$ Apr 07 07:58:29 ? Apr 07 07:58:32 I pay $199 Apr 07 07:58:37 Yup Apr 07 07:58:57 I haven't upgraded in since 10x :( Apr 07 07:59:20 rburton-: in my onCreate method Apr 07 07:59:49 So you're only changing the alpha before the list is rendered Apr 07 07:59:57 no Apr 07 08:00:14 Browser not sure what you're trying to do I guess then. sorry Apr 07 08:00:55 rburton- I have my ListView load, then the user swipes a card and I have to find an image with that tag to change the alpha Apr 07 08:01:31 you can just do view.findViewById(R.id.myImageViewName); then from there get the bitmap and modify it Apr 07 08:02:09 rburton- yes, the problem is get the view Apr 07 08:02:41 What's your event signature for the swipe look like? Apr 07 08:02:47 if I try with listView.findViewByTag , it doesn't find it Apr 07 08:02:56 gist? Apr 07 08:03:16 I have to get first the view inside, I guess Apr 07 08:03:16 I have to get first the view inside, I guess Apr 07 08:03:18 sorry Apr 07 08:05:20 Google is showing me loads of Square ads since I did google searchs for Square tape :/ Apr 07 08:05:32 imagine how many i get Apr 07 08:05:40 I couldn't it must be painful. Apr 07 08:05:55 every site, every youtube video, etc. Apr 07 08:05:58 Such a waste of money Apr 07 08:06:03 Me too I just got them on YouTube Apr 07 08:06:17 I just got another in a banner on a video. Apr 07 08:06:43 JakeWharton: Once I finish off this blog post on Tape, I'll send you a copy as well to review. Apr 07 08:06:48 Going to have Eric review it also Apr 07 08:20:19 Is SharedPrefferences acessible from every class in the package ? Apr 07 08:30:45 assuming you have access to a Context, yes Apr 07 08:31:14 Thanks Apr 07 08:52:26 JakeWharton: hows it going? Apr 07 08:55:12 good. busy busy busy Apr 07 08:55:18 as per usual Apr 07 08:55:44 i know the feeling Apr 07 08:55:47 how goes it yourself? Apr 07 08:56:12 im just tidying up some things for work tommorow, so i can go in and go "tada" all done Apr 07 08:56:44 hmm, ever implemented one of those expanding/collapsing views, like the extended textview thingy in google play? Apr 07 08:57:02 im thinking using a negative margin would do it Apr 07 08:58:15 I did it with a FrameLayout that accepts two children and toggles between the two Apr 07 08:58:23 drawing an arrow in the lower-right manually Apr 07 08:58:49 toggles between then, oh yea, the google one doesnt animate Apr 07 08:59:05 i was thinking of using an custom ValueAnimator one the layout params Apr 07 08:59:31 animating layout params is a slippery slope Apr 07 08:59:34 i know Apr 07 09:00:10 i just cant think of a better way, if you need it to animate open and its changes the layout then it has to invalidate and relayout Apr 07 09:01:23 now where did i see that swipe to delete code Apr 07 09:01:41 nurik wrote one Apr 07 09:01:48 hmm beta though Apr 07 09:05:11 I don't remember the name of it, but what is that time setting for the alarm manager that "isn't exactly 15 minutes, but close to it" ? Apr 07 09:05:20 oh well that exaplanation sucked Apr 07 09:06:14 i think i know what you mean Apr 07 09:06:27 Question: There are two views in my app, first is the content view and second is a sidebar. I have this button on top of the content view which makes the sidebar hides and shows( comes out from right). Is it logical to resize the content view ( which is horizontalscrollview ) at runtime ? any other idea? Apr 07 09:06:28 that's all I remember from google IO Apr 07 09:06:29 are you talking about setInexactRepeating? Apr 07 09:06:36 nhmmmmm Apr 07 09:06:38 yea Apr 07 09:06:44 thanks Apr 07 09:06:47 ! Apr 07 09:07:42 nice abstraction Apr 07 09:23:07 no idea? :/ Apr 07 09:23:47 hamid: i would look at one of the three libraries that offer that functionality and figure out what they do Apr 07 09:23:52 hamid no it would trigger layout pass Apr 07 09:24:18 you'll want hardware layers at the very least Apr 07 09:26:41 JakeWharton, would you describe more? Apr 07 09:26:51 no because i've never done it Apr 07 09:26:59 and if I did I would use a library Apr 07 09:27:39 JakeWharton, what are those three libraries? Apr 07 09:27:54 android-menudrawer, undergarment, SlidingMenu Apr 07 09:28:06 i would recommend the first one Apr 07 09:28:19 JakeWharton, thanks. Apr 07 09:32:41 wow eclipse, after 6 hours programming crashed on the only moment I didn't save the file, awesome Apr 07 09:33:18 oh man .... Apr 07 09:36:35 it doesn't auto-save? Apr 07 09:37:20 http://stackoverflow.com/questions/2943122/eclipse-auto-save Apr 07 09:37:57 IntelliJ has autosave on by default for everything, regardless of building state Apr 07 09:39:08 oh I usually have auto save turned on in my body's preferences Apr 07 09:39:33 I type ctrl +s every word I write Apr 07 09:40:05 nice Apr 07 09:40:07 it crashed when I deleted everything from a file Apr 07 09:40:12 do you use vim? Apr 07 09:40:14 and saved Apr 07 09:40:16 yea Apr 07 09:40:22 I mean Apr 07 09:40:29 I type esc :w Apr 07 09:40:34 everyword I write Apr 07 09:40:45 excellent. i've long said that vim isn't an editor but merely a tool for those who have OCD about saving Apr 07 09:41:05 What do you call the rotating progress icon? Apr 07 09:41:12 Spinner Apr 07 09:41:13 i thought it was a spinner but it wasn't Apr 07 09:41:24 er Apr 07 09:41:25 ProgressBar Apr 07 09:41:27 ProgressBar Apr 07 09:41:28 damnit Apr 07 09:41:31 i win Apr 07 09:41:42 is there a simple way to swap 2 widgets inside a linearlayout? Apr 07 09:41:49 i hate the name Spinner for the dropdown menus Apr 07 09:41:51 osxorgate: use a ViewAnimator Apr 07 09:41:53 or ViewSwitcher Apr 07 09:41:57 kevinb: agree Apr 07 09:42:03 thanks ill check it out Apr 07 09:42:14 kevinb: it made more sense back in the Android 1.0 days Apr 07 09:42:28 then i guess android asset studio doesn't support it Apr 07 09:43:01 osxorgate: have 3 and hide the left or right one depending on which way they should be? Apr 07 09:43:26 do0ob: heh interesting approach.. Apr 07 09:43:37 i reckon that could work for me Apr 07 09:44:22 If I pass an empty array to a list adapter will it crash? Apr 07 09:44:49 depends what list adapter Apr 07 09:45:02 (list adapter is an interface) Apr 07 09:45:16 but the answer you're probably looking for is: no Apr 07 09:45:29 hi all, I try to build one app which uses actionbarsherlock. I get following error within actionbarsherlock: The container 'Android Dependencies' references non existing library '/opt/android-sdk-update-manager/tools/support/annotations.jar'. I guess this annotations.jar was removed at some SDK update, is this correct? What is the direction for solving this problem? Apr 07 09:45:52 it wasn't removed Apr 07 09:46:06 hm, I'm missing this jar Apr 07 09:46:17 * monsti is missing you, too :( Apr 07 09:46:19 is your SDK up to date? Apr 07 09:46:33 I want to insert a value in a text field on a web site, press the button and retrieve the result content. I know how to retrieve content by getting the site content as String etc, but how can I do the first two parts? Apr 07 09:47:11 Quacked: send an HTTP request just like submitting the form does Apr 07 09:47:14 Quacked: just send a http POST with the data Apr 07 09:47:27 (or GET, w/e) Apr 07 09:47:27 Quacked: via an active post/get or via javascript or jquery Apr 07 09:47:29 yea but what if he wants to make a headless browser Apr 07 09:47:53 JakeWharton, yes, it is Apr 07 09:47:57 * monsti has to deal with headless users Apr 07 09:48:17 i've heard of blind and deaf users... but never headless Apr 07 09:48:29 JakeWharton, I've already updated everything via sdk manager and eclipse Apr 07 09:48:49 http://www.youtube.com/watch?v=KOmWOsfM6As <- the headless children ;) Apr 07 09:49:02 there are definitely brainless users though Apr 07 09:49:11 far too many Apr 07 09:51:14 hmm Apr 07 09:53:27 this is the html for the button (line 9) and text field http://pastebin.com/ir0nZuQ5 Apr 07 09:53:49 dude Apr 07 09:53:54 get firefox Apr 07 09:54:00 firebug* Apr 07 09:54:06 watch the network tab Apr 07 09:54:16 see what gets on the POST/GET Apr 07 09:54:17 JakeWharton, I found annotations.jar in ln -s /opt/android-sdk-update-manager/temp/ToolPackage.old02/support/annotations.jar annotations.jar, symlinked it now to '/opt/android-sdk-update-manager/tools/support/annotations.jar' and it looks good Apr 07 09:55:03 doutdes: good idea.. thats possible in opera too (which im currently using) Apr 07 10:01:27 So I think the search string is "MC=1&X2f1=bamse&X2ssy=S%F8k+Synonym&X2f2=". But am I far off thinking I could just do something like www.domain.org/X2index2.php?MC=1&X2f1=bamse&X2ssy=S%F8k+Synonym&X2f2= ? Apr 07 10:04:24 I think so Apr 07 10:04:34 if it's not a POST Apr 07 10:04:45 request Apr 07 10:05:35 POST /X2index2.php HTTP/1.1 Apr 07 10:06:10 So you can't Apr 07 10:06:24 use a HttpClient Apr 07 10:06:34 or UrlConnection... Apr 07 10:06:58 http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient Apr 07 10:07:01 although you probably want HttpClient since it'll hand-hold you Apr 07 10:07:57 already using httpclient to get the content as string Apr 07 10:08:59 nameValuePairs.add(new BasicNameValuePair("MC", "1")); Apr 07 10:09:01 nameValuePairs.add(new BasicNameValuePair("X2f1", "bamse")); Apr 07 10:09:03 nameValuePairs.add(new BasicNameValuePair("X2ssy", "S%F8k+Synonym")); Apr 07 10:09:05 nameValuePairs.add(new BasicNameValuePair("X2f2", " ?")); Apr 07 10:09:31 thanks :D Apr 07 10:11:57 Is cancel() on onPause() enough to stop an alarm manager ? Apr 07 10:13:22 I mean, is onPause() called when the app is closed ? Apr 07 10:14:57 onPause is called when your activity is no longer displayed on screen Apr 07 10:15:23 So if it's force closed it will not end the alarm manager Apr 07 10:17:22 motherfucker i just spent like 20 minutes trying to figure out why my adapter wasn't populating my list items... turns out i had my listview height set to 0dp. Apr 07 10:18:53 uh Apr 07 10:18:59 i'm having the same problem Apr 07 10:19:02 for an house Apr 07 10:19:04 hour* Apr 07 10:19:09 if that's the problem I will kill myself Apr 07 10:27:47 doutdes: looks like its working fine :D Apr 07 10:27:50 thanks a bunch Apr 07 10:30:09 np Apr 07 10:36:54 I am trying to update the alpha of a image inside a ListView. I have tried with getChildAt() but It is always null. How should I do it? Apr 07 10:38:42 How do i check that an activity still has focus? Apr 07 10:39:24 i have an asynctask and i want to pass it an activity, but what if the activity no longer exists when the task finishes? Apr 07 10:42:45 Now I have a list of Elements that I want to display, each on a new line (scrollable). Should I use ListView for that or something else? Apr 07 10:42:58 ListView Apr 07 10:42:58 The number of elements varies Apr 07 10:43:09 Okidoke. Thanks. Apr 07 10:51:16 ow .. didn't think this through.. in my activity's oncreate i check a pref, and load a layout depending on it. now when i go to prefs and change the setting and return, of course the new layout isn't loaded yet Apr 07 10:51:47 maybe i could force recreation of the activity? or what's the better solution Apr 07 10:58:58 osxorgate: set the new layout in onActivityResult Apr 07 10:59:46 i also think there is a prefchanged handler Apr 07 11:10:21 hm i just removeAllViews() and add them again in onResume Apr 07 11:10:25 seems to work Apr 07 11:10:27 bit hacky Apr 07 11:25:56 hi I have troubles with a Android Installation on ubuntu... http://developer.android.com/sdk/installing/adding-packages.html I can't find "tools/" folder .. can somebody helpme? Apr 07 11:29:14 HerbertWest, why you no just download the bundle package ? Apr 07 11:29:35 HerbertWest, and don't forget to install JDK. Apr 07 11:29:52 ok Apr 07 11:29:59 ill do that Apr 07 11:30:24 tty Apr 07 11:30:35 yw. Apr 07 11:40:30 When inserting values into a SQLITE database how do i encode it? Apr 07 11:40:47 i want to avoid _ and % in values messing with queries i will perform later Apr 07 11:41:07 do0ob: there are sql parameters in sqlite/android Apr 07 11:41:38 e.g inser into ? (foo,bar) values (?,?) Apr 07 11:46:16 Which is the best way while working with custom layout listView and sqlite? lazyAdapter or cursorAdapter? Apr 07 11:46:45 i always crate my own adapter derived from baseadapter Apr 07 11:47:37 monsti: oh, i see, i was going to use raw queries, so i guess i'll use that instead Apr 07 11:48:05 no wait, i get it now Apr 07 11:49:08 i'm using a contentprovider and a loadermanager, seemed the easiest way to get the job done Apr 07 11:52:14 hey monsti, would you mind to give some blogpost / article that talk about how to maintain custom listView using sqlite, sharedprefs or something? Apr 07 11:52:39 xviv you can make your own adapter extending BaseAdapter Apr 07 11:52:49 give it a cursor and in getView moveToPosition(position) Apr 07 11:52:51 I mean, written by another. Not you :D. I can't get it from d.android.com :| Apr 07 11:53:13 xviv did you watch 'world of listview' on youtube Apr 07 11:53:43 xorgate, never heard before. Off to find it. :) Apr 07 11:54:40 wow, long durated vid. Gotta buffer it with my slow connection. Thank you xorgate :) Apr 07 11:54:51 xviv mandatory for all android devs Apr 07 11:55:18 get a yt download plugin in your browser ;) Apr 07 11:56:01 I use idm btw, don't worry :) Apr 07 11:56:16 idm = ? Apr 07 11:56:25 internet download manager. Apr 07 11:56:36 it has plugin for download vid from yt. Apr 07 11:57:17 JakeWharton, android-menudrawer is perfect! thank you for suggesting that. Apr 07 11:57:25 I said buffer because I thought downloading vid from yt is inappropriate, lol Apr 07 12:18:44 Hello :) Apr 07 12:19:27 I build application where i will need communicate with my server, What will be the best? some http json handler or GCM ? Apr 07 12:21:49 Also for specific device i need to be able define hew pictures that need to be downloaded and displayed Apr 07 12:21:59 suppose for that i will use GCM Apr 07 12:36:53 what is GCM? Apr 07 12:37:13 google cloud messaging? Apr 07 12:38:05 yes Apr 07 12:39:17 hi everybody. I have written a little test App that gets the camera preview images to process them. I have read through SO the last days and now have an implementation that uses several buffers for the data, but I still only get up to 11 FPS on my Nexus 4. When I run the same app on my old HTC Desire instead, I get between 23-30 FPS. Apr 07 12:39:32 downloading a few pics seems like a pure get operation Apr 07 12:39:51 Is the Nexus 4 camera just bad or is are there some special settings necessary? I mean the default camera app shows the images much smoother. Apr 07 12:40:40 why are you using a camera preview? sounds like you want to record video Apr 07 12:44:13 hi guys! Apr 07 12:44:16 hi Apr 07 12:44:57 do0ob: well I need it for an augmented reality app. I need to pass each (almost each) frame to some image processing routines. Apr 07 12:45:41 therefore recording video wouldn't help much Apr 07 12:47:56 i thought that maybe you could set the camera to low quality and read the output file Apr 07 12:48:32 maybe the previews are capped Apr 07 12:58:59 evident: got you covered bro Apr 07 12:59:11 http://johnnystreet.com/CanvasLand/ ;D Apr 07 12:59:23 feel free to steal CameraTrack.js and modify as necessary Apr 07 12:59:32 *Tracker? Apr 07 12:59:59 you can see it in action here: http://www.youtube.com/watch?v=bkWEqGHirJw Apr 07 13:00:25 hahaah shit Apr 07 13:00:35 I thought I was looking at #three.js :( Apr 07 13:00:49 but I have the same code done in java if you want it too Apr 07 13:04:52 Anyone knows why one some rare device context.getResource() may return null when the context class is Application ? Apr 07 13:24:39 mornin Apr 07 13:47:20 hi Apr 07 13:47:42 is it able to create a dialog that wont affect the background focus of my contentview? Apr 07 13:59:12 yellow everybody Apr 07 14:18:32 anyone? Apr 07 14:19:39 Every time I start my app, I get this stacktrace: http://pastie.org/7351729 Apr 07 14:19:52 I have no idea what's causing it as it doesn't give any line numbers in my code :| Apr 07 14:21:27 Also is there any way I can get the "11 more" to expand? Apr 07 14:27:30 when you think you have seen every possible crash report, there always something new: "java.lang.RuntimeException: createWindowSurface failed EGL_BAD_ALLOC" Apr 07 14:29:13 anyone knows its able to show a dialog while the background activity still operational ? Apr 07 14:29:28 i just want to show a sprite in dialog Apr 07 14:29:55 BulleTime: you could give it a dialog-style Apr 07 14:30:05 i did, i think Apr 07 14:30:13 for example an activity with dialog style Apr 07 14:30:40 i am overwriting