**** BEGIN LOGGING AT Thu Dec 11 02:59:57 2008 Dec 11 14:44:35 anyone know how to find out what height ?android:attr/listPreferredItemHeight actually is? Dec 11 14:45:08 for the current theme? Dec 11 15:59:21 duncanfoo: from grep: frameworks/base/core/res/res/values/themes.xml: 64px Dec 11 17:31:43 hey zach, ltns it feels like Dec 11 17:36:49 jasta: yeah, moving this weekend Dec 11 17:36:51 been busy Dec 11 17:46:55 moving? where to? Dec 11 17:47:01 ohio :( Dec 11 17:47:19 uhhh, *WHY*!? Dec 11 17:47:31 hehe...only temporary Dec 11 17:47:59 startups either fail or succeed fairly quickly Dec 11 17:48:10 you goin to work for a startup in ohio? Dec 11 17:48:17 haha, I know, it's crazy Dec 11 17:48:22 that does sound crazy :) Dec 11 18:42:19 do you have to enable javascript in a webview? Dec 11 18:45:45 jammr: I know it's settable by the app, I don't remember whether it's on or off by default. Dec 11 19:17:37 jammr: it's off by default Dec 11 19:18:08 I got it, thank you though :) Dec 11 19:53:44 jasta: Are you available for a short question? Dec 11 19:54:23 don't you mean 2? Dec 11 19:54:34 oh well :) Dec 11 19:54:56 I'm from Germany so is "to" the right way to say that? :) Dec 11 19:55:30 anno^da_: You said it correctly Dec 11 19:55:49 Ah ok finde. Dec 11 19:55:49 two short questions. since you opened with the first one. Dec 11 19:56:13 Now I'm totally confused. :D Dec 11 19:57:15 its not important Dec 11 19:57:28 ("can I ask a question?" "you just did.") Dec 11 19:57:42 anno^da_: You are better at English than I am at Deutsch. :) Dec 11 19:57:51 :) Dec 11 19:59:24 Why aren't the IDL files provided in the open-source code? (Or maybe they are, and I just don't see them) Dec 11 20:00:33 Surely IDLs were used for the IPC calls like in the MediaPlayer source Dec 11 20:07:46 nm, found a forum post with hackbod basically saying they were written by hand (with some minor macro support) Dec 11 20:16:45 FWIW, it seems like most (all?) of the binder usage in the source tree happens from C++. There's a Java API, but it seems to be mostly ignored. Dec 11 20:18:41 I'm still not sure what to think about binder. I love the read/write "scheduler-knows-that-it's-an-RPC" thing. But it seems like that could have been done in a more integrated way, maybe with the syslets patch, or just scheduler changes, or a flag to sengmsg, ... Dec 11 20:27:08 I'm not very familiar with IPC techniques. Just starting to understand this binder stuff Dec 11 20:28:13 The documentation seems rather slim. The most help I got was from reading the Open-Binder docs. Without that I'd still be so lost Dec 11 20:28:23 dgBlue Battery! Dec 11 20:30:57 anno^da_: sure Dec 11 20:34:11 The source is the best reference to the binder stuff I've seen. The old page I was pointed to (on archive.org -- the original was taken down) was mostly just high level stuff, where it just looks like another ORB to me. It's the system call interface that's important and interesting. Dec 11 20:50:11 Hi all. I have a general architecture question. I have an app, with one Activity that lists things. I want to start a new Activity that operates on one of those items from the first list. Easy enough, right? Dec 11 20:51:06 yes, very easy Dec 11 20:51:57 So far, my first list is made from a list of objects I create. I don't see how to pass or access that object from the other activity. Assume it can't be serialized easily into a string and poked as extra data into the Intent. Am I missing something obvious? Dec 11 20:52:47 if it is a non-trivial object that cannot be serialized or expressed using a Bundle, then you will need to share a reference to it in a way that restricts your applications flexibility Dec 11 20:52:47 I guess I have the Intent and the Context to play with, but I don't see anything yet. Dec 11 20:53:00 one easy method is to put the stuff in the app Dec 11 20:53:25 all the activities in a single application share the application object Dec 11 20:53:27 I don't mind hard-coding my new class as the intent receiver, fwiw. Dec 11 20:53:35 subclass that and put your shared data in there Dec 11 20:53:58 yes, i agree with duncanfoo's suggestion. Dec 11 20:54:39 is there a tutorial on using threads with android? Dec 11 20:54:47 CardinalFang: by default, all activities in an application run in the same process (and thread, but that is less important). so, they can share memory by just have static references to it. subclassing Application can give you that intuitive static context. Dec 11 20:55:03 bparker06: it isn't any different than using threads in other java applications, actually. Dec 11 20:55:17 I need to put a URLConnection in a new thread and then be notified when it's complete, and of course bring the results back to the parent Dec 11 20:55:29 jasta: actually I've never used threads in java... Dec 11 20:55:37 bparker06: pull down the source code to apps-for-android, it's a google project. Dec 11 20:55:43 ok Dec 11 20:55:50 in it, find UserTask.java in the Photostream app. It is an abstraction that will help you. Dec 11 20:55:56 cool Dec 11 20:55:57 thanks Dec 11 20:55:57 "Base class for those who need to maintain global application state." Well, duh, that's annoyingly simple now that i see it. Thank you, duncanfoo and jasta. Dec 11 20:55:58 :) Dec 11 20:56:19 the most important thing is to strictly separate the data & ui Dec 11 20:56:33 if you try to bundle lots of state into the activity you'll fail ;) Dec 11 20:56:40 CardinalFang: do note that if you keep a static reference to an object so massive its infeasible to pass it around through bundles, you will probably exhaust the phones memory pretty quickly holding onto it indefinitely. Dec 11 20:56:56 so, you need to be cautious of how much memory your app is wasting Dec 11 20:57:17 jasta, Noted. Thanks. Dec 11 21:00:16 bparker06: by the way, i still highly recommend that you find some reading material online or at a book store on Java threading. Threading is a very complex topic which is tragically misunderstood by humans. You will likely fail to develop client software without familiarity of this topic. Dec 11 21:01:29 with a typical android app its also likely more complex than you think because you'll typically need to decouple the activity and the thread (and the results from the execution of the thread) Dec 11 21:12:23 I have a fun question for anyone that knows the MediaPlayer and the binder IPC well. When I call a function from the BpMediaPlayer (e.x. seekTo) it makes a call to transact(code, data, reply, flags). Now if I understand correctly, on the service process MediaPlayerService::client will handle the seekTo function. But how do you go from transact to seekTo? I see an onTransact method in BnMediaPlayer, but isn't that being called on Dec 11 21:23:36 hmm ok i think i see now. I'm guessing when MediaPlayer connects to MediaPlayerService, the create method is called in MediaPlayerService. This create method instantiates a client object, which inherits BnMediaPlayer! Seems clear, all though weird since I thought BnMediaPlayer is only for local calls Dec 11 23:10:22 what happened to ProgressDialog? Dec 11 23:10:31 eated Dec 11 23:10:41 actually should still be around Dec 11 23:10:45 also it seems ProgressBar is kinda broken Dec 11 23:10:50 or either I *really* don't know how to use it. Dec 11 23:11:05 the latter is more likely :P Dec 11 23:11:13 setIndeterminate(false) does not do anything Dec 11 23:11:22 should it not stop the animation? Dec 11 23:11:33 it shouuld Dec 11 23:11:35 *should Dec 11 23:11:49 that's what I thought... Dec 11 23:11:52 but it doesn't do anything for me Dec 11 23:12:46 have you set the progress and max values to reasonable values? Dec 11 23:13:03 should indeterminate progressbar's have those? Dec 11 23:13:23 no, but definite ones should Dec 11 23:13:36 if you"re setting indeterminite(false) Dec 11 23:13:44 when I add a progressbar it's indeterminate by default Dec 11 23:13:45 I don't know, tbh Dec 11 23:13:47 which is what I want Dec 11 23:13:50 right Dec 11 23:13:53 but when you make it determinite Dec 11 23:13:54 but then setting it false does not stop the animation Dec 11 23:14:00 ah. Dec 11 23:14:03 wait, when you say stop the animation Dec 11 23:14:06 do you mean dismiss the dialog Dec 11 23:14:09 or just stop it from animating Dec 11 23:14:15 ProgressBar has no dialog Dec 11 23:14:19 so just stop it from animating Dec 11 23:14:22 ProgressBar is a dialog Dec 11 23:14:47 hmm, well from what I understand it's just another widget Dec 11 23:14:57 but I don't quite grasp everything just yet. Dec 11 23:15:01 http://forums.somethingawful.com/showthread.php?threadid=2803848&userid=0&perpage=40&pagenumber=152 Dec 11 23:15:05 argh Dec 11 23:15:08 stupid synergy Dec 11 23:15:26 search for ProgressDialog in the code.google.com/android/ bar Dec 11 23:15:36 yea I saw that Dec 11 23:15:44 and that is definitely a dialog Dec 11 23:15:48 (that doesn't exist anymore apparently) Dec 11 23:15:52 it's not in the 1.0 sdk jar Dec 11 23:16:00 (r2) Dec 11 23:16:01 well we're using it in our code Dec 11 23:16:13 I only see ProgressBar.class Dec 11 23:16:17 and that one has no text with it Dec 11 23:16:22 it's just a animating circle Dec 11 23:16:29 ... Dec 11 23:16:57 use ProgressDialog.show(context, title, message, true) to get a ProgressDialog Dec 11 23:17:03 or, create one Dec 11 23:17:11 ProgressDialog pg = new ProgressDialog(context); Dec 11 23:17:16 pg.setIndeterminite(true); Dec 11 23:17:25 pg.show(); Dec 11 23:17:42 you can't stop it from animating Dec 11 23:17:47 or, maybe you can, but I just don't know how Dec 11 23:17:59 you can always provide your own drawable and control that somehow... Dec 11 23:18:07 hmm, apparently it's android.app.ProgressDialog Dec 11 23:18:10 but anyway Dec 11 23:18:12 yes Dec 11 23:18:20 I was adding ProgressBar from main.xml Dec 11 23:18:24 instead of in the code Dec 11 23:18:29 because that part I don't understand yet Dec 11 23:18:37 like when you add things from the code, how does it know where to put it, etc. Dec 11 23:18:41 there is a style you have to use to do a determinate horizontal progress bar Dec 11 23:18:43 UI-wise Dec 11 23:18:54 well, for dialogs, generally it gets put on top of everything else Dec 11 23:19:07 yea that I understand Dec 11 23:19:09 you probably shouldn't put a progress dialog in xml, but I guess there might be reasons to do that? Dec 11 23:19:13 I wouldn't think so Dec 11 23:19:23 well I don't need to do that if the dialog is modal Dec 11 23:19:24 I'm heading home, please bother zhobbs : ) Dec 11 23:19:37 ok Dec 11 23:19:39 bye o/ Dec 11 23:19:52 try adding: style="?android:attr/progressBarStyleHorizontal" Dec 11 23:20:07 zhobbs: the default ProgressBar as it is when dropped into the UI view (using exclipse) is just a circle... Dec 11 23:20:12 eclipse* Dec 11 23:20:25 bparker06: yeah, you need to add that style to make it a horizontal bar Dec 11 23:20:28 really all I want is that circle to work, and no dialog Dec 11 23:20:35 but I don't want it to be horizontal :) Dec 11 23:20:56 bparker06: I don't think you can do a determinate circle anymore.... Dec 11 23:21:04 I don't want it determinate Dec 11 23:21:06 I want it indeterminate Dec 11 23:21:15 oh, sorry, then what's the problem? Dec 11 23:21:23 I cannot stop/start the animation Dec 11 23:21:37 setIndeterminate() simply does nothing Dec 11 23:22:08 yeah, I think that's normal though Dec 11 23:22:12 you just want to hide/show it Dec 11 23:22:18 well Dec 11 23:22:23 that is another problem Dec 11 23:22:32 if I default it to hidden... when I go to show it, it doesn't animate Dec 11 23:22:35 it's stopped Dec 11 23:22:50 I do that all the time Dec 11 23:22:51 and from then, setting setIndeterminate(true) doesn't start the animation either Dec 11 23:22:58 so I'm stuck Dec 11 23:23:02 hide/show it, and haven't run into that problem Dec 11 23:23:51 you using hidden or gone? Dec 11 23:24:08 setVisibility() Dec 11 23:24:25 1 and 0 Dec 11 23:24:42 because I can't figure out how to refer to the constants Dec 11 23:25:00 setVisibility( View.GONE ); Dec 11 23:25:16 setVisibility( View.VISIBLE ), View.HIDDEN, etc Dec 11 23:25:39 what's the difference between hidden and gone? Dec 11 23:25:43 that's probably your issue Dec 11 23:26:11 hidden means just not visible, gone means the layout is rendered as if the view isn't there Dec 11 23:26:22 ah ok Dec 11 23:26:24 ie, hidden it could still take up space in a layout, gone it doesn't Dec 11 23:26:29 gotcha Dec 11 23:26:52 try those, because 1 isn't a valid value for setVisibility() Dec 11 23:27:24 "View.HIDDEN cannot be resolved" Dec 11 23:27:31 ahh, sorry View.INVISIBLE Dec 11 23:27:50 ah Dec 11 23:28:20 I'm leaving too, good luck :) Dec 11 23:28:47 ok, I got it Dec 11 23:28:58 apparently the problem was using 1 and 0 on setVisibility Dec 11 23:29:03 it's not what I thought it meant :P Dec 11 23:29:06 thanks a bunch Dec 12 00:13:58 Hi, I'm wanting my app to be able to toggle certain phone settings. Where might I find some code examples that show how to do this? Dec 12 00:16:05 I'm assuming this is done using intents... just not sure exactly how to do it Dec 12 00:16:12 (this is my first app) Dec 12 00:17:45 how would I get the contents of an http request as a string (a plaintext file)? Dec 12 00:18:04 savid: what settings? Dec 12 00:18:52 jammr, something like response.getEntity().getContent() Dec 12 00:18:57 zhobbs, well, for example, enable/disable bluetooth or enable/disable gps.. things like that Dec 12 00:19:03 jammr: http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html Dec 12 00:19:07 I'm not sure on that, but it's close. Check the HttpClient docs Dec 12 00:19:18 jammr, if you find a better way, let me know Dec 12 00:20:53 zhobbs, I'm wanting to make a "quick settings" app (yeah, I know there are a couple already, but I'd like to make my own "just for fun") Dec 12 00:23:07 savid: hmm, not sure actually....I see there is a content provider for those settings Dec 12 00:24:36 zhobbs, yeah, I'm going through the Settings manifest right now to see what's available Dec 12 00:24:52 I know other apps are able to do it, just need to figure out how they do it Dec 12 00:25:05 savid: do you have the android-git repo downloaded? Dec 12 00:25:14 zhobbs, yeah Dec 12 00:25:40 that Settings app does it all Dec 12 00:25:52 I see wifi can be enabled/disabled via WifiManager Dec 12 00:26:18 yea that seems redundant Dec 12 00:29:32 looks like bluetooth is enabled/disabled in the Settings app via a private api... Dec 12 00:30:44 looks like the location settings are set via that ContentProvider Dec 12 00:31:41 savid: I think this is the ticket: http://code.google.com/android/reference/android/provider/Settings.System.html Dec 12 00:32:18 oh yay :) Dec 12 00:32:24 from the Settings app: Settings.System.putString(getContentResolver(), Dec 12 00:32:24 Settings.System.LOCATION_PROVIDERS_ALLOWED, providers); Dec 12 00:32:44 to set wifi/network, etc Dec 12 00:35:13 zhobbs, awesome, that was exactly what I was looking for. Thanks! Dec 12 00:40:29 cool, you can also see the raw table @ /data/data/com.android.providers.settings/databases/settings.db Dec 12 00:43:40 I'm trying to extend the notes demo application to incorporate a context menu. I've got: registerForContextMenu(getListView()); for the Notepadv3 class, and have an override for OnCreateContextMenuListener. I set the menu's title. When I run the emulator though I do not see any context menu (it's an empty one). Dec 12 00:44:11 the register is in the onCreate method. Do I need to override another method? Dec 12 00:44:24 snappy: did you add menu items to the menu? Dec 12 00:45:25 I've added one (just now). menu.add(0,0,0,"test"); Dec 12 00:45:52 I still don't get a context menu appearing when I long tap the item. Dec 12 00:46:42 Also, how would I get the selected id from the ContextMenuInfo? Dec 12 00:47:49 (int)((AdapterContextMenuInfo)item.getMenuInfo()).id Dec 12 00:51:14 Here is the main java file from the notepad application: http://rafb.net/p/4fk60C21.html -- I made the modifications at line 44 and 111-117 Dec 12 00:51:29 KNY, zhobbs Thank you :) got it Dec 12 00:55:52 snappy: fyi, there is no header on the ContextMenu afaik Dec 12 00:57:49 oh, hm. Dec 12 00:57:58 there is one Dec 12 00:58:09 its in the docs Dec 12 00:58:14 i think im registering the wrong listview. Dec 12 00:58:38 michaelnovakjr_: hmm, never seen it before I guess Dec 12 01:01:47 is there a way to make an http request when a call comes in, and then display some info based on the calling number, before you answer the call? Dec 12 01:02:01 (without wifi) Dec 12 01:02:26 or if data access isn't available, could you substitute a local sqlite db? Dec 12 01:02:37 available while a call is incoming, that is Dec 12 01:02:54 ok i figured it out. I had to put the registerForContextView in the fillData() Dec 12 01:03:18 But I'm not unregistering the old contextview.w Dec 12 01:34:10 So now I have my context menu appearing and I am overriding onContextItemSelected. I've littered the method with Log.v() functions on entry, but when I select something from my context menu it doesn't seem to execute onCtextItemSelected (according to the logs). Any ideas what I maybe missing? Dec 12 01:38:07 hmm Dec 12 01:47:44 hi Dec 12 01:48:06 how to "invalidate()" out of an Activity? Dec 12 02:02:01 So I figured out the issue with the context menu. For some reason I can't create a menu without making all items unspecified. Dec 12 02:02:06 as in each item cannot have an ID Dec 12 02:02:31 I tried to do menu.add(0, 1, 0, ...) menu.add(0, 2, 0, ...) but then the onContextItemSelected doesn't fire. Dec 12 02:03:02 Im doing the same thing with the options menu, so I don't know why it's not working with the context menu. Dec 12 02:18:17 snappy, what I'm doing is menu.add(Menu.NONE, SOME_ID, Menu.NONE, R.string.my_string); Dec 12 02:18:20 and it works fine Dec 12 02:20:07 I've been trying that and it seems the menu breaks. Can the ID be arbritrary? Dec 12 02:21:26 mine start with Menu.FIRST and go up from there Dec 12 02:22:22 Yep, that's exactly what i'm doing: Dec 12 02:22:50 menu.add(Menu.NONE, Menu.FIRST, Menu.NONE, "Share"); menu.add(Menu.NONE, Menu.FIRST+1, Menu.NONE, "Share"); Dec 12 02:22:53 before I add stuff to the menu I do menu.setHeaderTitle(R.string.my_header) Dec 12 02:23:01 but I doubt that's required Dec 12 02:23:34 Then on my onContextItemSelected I do: switch(item.getMenuId()) { case Menu.FIRST: ... case Menu.FIRST+1: ... Dec 12 02:23:41 The problem is onContextItemSelected doesn't even fire. Dec 12 02:24:36 weird Dec 12 02:24:43 can you pastebin.ca those two methods? Dec 12 02:25:58 yeah sure. Dec 12 02:27:34 http://pastebin.ca/1283195 Dec 12 02:28:02 so if i do menu.add(0,0,0,...) then the onContextItemSelected will fire. Dec 12 02:28:16 Also the logs say: Added menu item: 1, Added menu item: 2. Dec 12 02:28:45 In the API docs it says: It is not safe to hold onto the menu after this method returns. Dec 12 02:28:48 What does that mean? Dec 12 02:31:47 what is the thread-safe alternative to android.net.Uri.Builder ? Dec 12 02:32:30 snappy, it's saying don't do like m_menu = menu; Dec 12 02:32:34 and then use it later Dec 12 02:33:00 ah ok, at least that I'm not doing. Dec 12 02:33:40 But I still have the issue that I cannot create the menu with unique identifiers for each item. Even though it says it has added them with unique IDs. Dec 12 02:33:49 anyone know? Dec 12 02:33:52 Or rather, I dont know why onContextItemSelected doesnt fire. Dec 12 02:33:56 snappy, neither one works? Dec 12 02:34:12 bparker06, I don't know, sorry (that's not to say that no one knows, just that I don't) Dec 12 02:34:21 KNY: I can create the context menu when all the item identifiers are 0. Dec 12 02:34:32 and it will fire onContextItemSelected. Dec 12 02:34:33 yeah, but as you pastebinned it, neither one fires? Dec 12 02:34:41 Neither fires. Dec 12 02:35:58 Also, when the item id is set to 0, the getListView.getSelectedItemId() == List View id selected = -9223372036854775808. Dec 12 02:36:23 I don't know what's going on there either, works fine for the option menu though. Dec 12 02:37:17 Wait, do I need to instantiate a new menu object? Dec 12 02:45:29 snappy, nope Dec 12 02:46:29 Yeah, I have no idea then. I'm just extending the basic Notepad application in the google tutorial. Dec 12 02:49:18 I'm also overriding onListItemClick, but I assume that won't conflict with the onContextItemSelected? Dec 12 02:51:39 it shouldn't, no Dec 12 02:51:44 but you must be doing something else goofy Dec 12 02:51:53 try not overriding that Dec 12 02:52:14 I see nothing that would cause that to not be called Dec 12 02:56:58 ok one sec Dec 12 02:57:47 Nope, nothing, let me paste the full source Dec 12 02:59:27 http://pastebin.ca/1283222 **** ENDING LOGGING AT Fri Dec 12 02:59:57 2008