**** BEGIN LOGGING AT Sun Dec 30 02:59:57 2007 Dec 30 03:53:35 Anybody know anything about programmatically adding views to a ListActivity's ListView ? Dec 30 05:00:31 ok nak chow dulu... wtf... fakap you all!!! Dec 30 05:12:45 Anybody know how to debug why an intent isn't recieved by what (i think) should be the appropriate intent reciever? Dec 30 16:08:29 spoiler: next release will be "m3-rc39" Dec 30 16:08:31 :p Dec 30 16:28:15 WHAT THE HECK ARE THE ARGUMENTS FOR SHOWALERT Dec 30 16:28:23 you're pissing me off, android! Dec 30 16:28:37 EXTREMELY, YES Dec 30 16:30:11 what is the correct call for an OK and Cancel alert dialog with at least a message as argument for the OK button Dec 30 16:30:22 I don't care about the cancel button, as long as it's there Dec 30 16:33:27 tulcod: Dec 30 16:33:51 showAlert("title of alert goes here", "ok or cancel?", "Cancel", null, "Ok", new DialogInterface.OnClickListener() { Dec 30 16:33:55 public void onClick(DialogInterface dialog, int whichButton) Dec 30 16:33:55 },false, null); Dec 30 16:33:58 { Dec 30 16:34:00 // What to do when Ok is selected goes here Dec 30 16:34:03 } Dec 30 16:34:20 o.0 Dec 30 16:34:21 ok Dec 30 16:34:23 thx Dec 30 16:34:29 a lot lol :p Dec 30 16:34:40 no problem Dec 30 16:37:36 Lede: woot, it actually works (with { } after whichButton) ) Dec 30 16:38:02 I tried to do it the other way, like, replacing cancel and ok, I guess Dec 30 16:38:09 whatever, it works now Dec 30 16:47:50 tulcod: when you just can't figure out something take a look at the ApiDemo's source code Dec 30 16:48:07 sometimes documentation only doesnt cut it Dec 30 16:48:12 Lede: hm, yeah... Dec 30 16:48:47 Lede: well, I really couldn't find some more things earlier, so that's why I simply am becoming frustrated. I just released all my anger ;) Dec 30 16:50:18 i know Dec 30 20:27:20 what widget is used in the Contacts program for the horizontal break (like HTML's
) thing? Dec 30 20:30:07 Menu has addSeparator() .. but that only works inside the pop-up menu Dec 30 20:32:18 Lede: newline? no idea Dec 30 20:35:49 tulcod: i meant
Dec 30 20:36:31 why is it being marketed as open source when not everything is open source anyways.. Dec 30 20:41:38 Lede: yeah, that's what I thought Dec 30 20:43:37 Lede: ListView can have separators Dec 30 20:43:50 otherwise you can use a View, give it a background color and a fixed height Dec 30 20:47:40 romainguy_: how would you add a horizontal break thing to a ListView then? Dec 30 20:47:57 the list adapter can specify separators Dec 30 20:51:08 romainguy_: i can't find the method in the documentation Dec 30 20:52:06 maybe you don't understand what i mean with seperator.. :/ Dec 30 20:52:47 romainguy_: what i'm looking for is the same horizontal line thing you get by using addSeparator() in a menu Dec 30 20:57:16 does SharedPreferences.getString(String, String) do any weird interpretation on the second argument? Dec 30 21:09:02 does the TabActivity work? Dec 30 21:14:42 EditText vw = (EditText)findViewById(R.id.text); Dec 30 21:14:43 // Set the EditText's text. Dec 30 21:14:43 vw.setText("Italic, highlighted, bold."); Dec 30 21:14:43 // If this were just a TextView, we could do: Dec 30 21:14:43 // vw.setText("Italic, highlighted, bold.", TextView.BufferType.SPANNABLE); Dec 30 21:14:43 // to force it to use Spannable storage so styles can be attached. Dec 30 21:14:44 // Or we could specify that in the XML. Dec 30 21:14:46 // Get the EditText's internal text storage Dec 30 21:14:48 Spannable str = vw.getText(); Dec 30 21:14:50 it's not that easy, really Dec 30 21:14:54 whoops, big paste, sry Dec 30 21:15:06 frikkin android :p Dec 30 21:19:30 what do you suppose is so useful about comments like "Set the EditText's text"? Dec 30 21:19:37 do you find that it helps you? Dec 30 21:19:51 jasta: no Dec 30 21:20:01 cause I did and eclipse complains about errors in my project Dec 30 21:20:40 what? Dec 30 21:20:41 so I hereby declare that I officially hate android Dec 30 21:20:52 well, pretty much everything they said Dec 30 21:21:00 See, you're not making any sense again. Remember how we've been over this before? Dec 30 21:21:03 only difference is that I'm using a textview instead of an edittext Dec 30 21:21:06 I guess? Dec 30 21:21:31 So, take a deep breath and try explaining your problem. Dec 30 21:22:01 nvm Dec 30 21:26:40 jasta: do you have an idea how they added that
separator thing in the Contacts program? Dec 30 21:27:56 not sure what you mean, hang onm Dec 30 21:27:57 Lede: use a View with a background color and a fixed height Dec 30 21:27:58 on* Dec 30 21:29:08 romainguy_: btw, have you guys looked at the implicit margins problem created by the selector drawable? Dec 30 21:29:19 that bug is so annoying to look at. Dec 30 21:29:31 what bug? Dec 30 21:30:30 http://groups.google.com/group/android-developers/browse_thread/thread/7b423bcf26de319e Dec 30 21:30:33 romainguy_: i havnt tried it, but thats sounds like a really weird way to achive that Dec 30 21:30:54 Lede: why? Dec 30 21:31:30 Lede: oh, i know what you mean. i "faked" one of those in my RSS reader actually. it's not just a static background color, there is also a couple of rows of alpha blended pixels in there. Dec 30 21:32:04 romainguy_: because i would expect there to be a way to add one without doing all that Dec 30 21:32:39 one that behaves like a widget would be nice Dec 30 21:33:15 hm, i guess ill just do it differently Dec 30 21:33:23 but View is a widget Dec 30 21:34:23 but the horizontal break isnt Dec 30 21:34:54 wait.. Dec 30 21:37:22 romainguy_: i just encountered a very strange bug here... Dec 30 21:37:41 jasta: with the padding in list? Dec 30 21:37:43 i fired up my RSS reader application after a few days of barely touching it... Dec 30 21:37:48 and got: Dec 30 21:37:54 E/ContentProviderDatabaseHelper( 638): Error starting provider Dec 30 21:37:54 E/ContentProviderDatabaseHelper( 638): java.io.FileNotFoundException: Database at databases/rss_reader.db could not be created Dec 30 21:38:06 called down from dbHelper.openDatabase(...) Dec 30 21:38:27 (where dbHelper is a DatabaseHelper instance, obviously) Dec 30 21:39:00 first of all, if the database didn't exist by name, that code is designed to create it, right? second, it does exist, at the same location it always has: /data/data/org.devtcg.rssreader/databases/rss_reader.db Dec 30 21:39:26 at one point, my emulator ran out of disk space when i was tinkering with something, and i think that may have triggered this but i can't be certain about the timeline. Dec 30 21:39:27 jasta: did you get a "mismatched" error in logcat? Dec 30 21:39:48 for some reason that program now isnt recognized as the real RSS reader Dec 30 21:39:56 if you got that message.. Dec 30 21:39:59 you should just Dec 30 21:40:25 Lede: no? but there is more in the log i just noticed: Dec 30 21:40:38 E/Database( 638): Failed to open database file "databases/rss_reader.db" - unable to open database file Dec 30 21:40:41 E/Log ( 638): Saving exception to database. Dec 30 21:40:43 E/AndroidRuntime( 638): java.io.FileNotFoundException: Database at databases/rss_reader.db could not be created Dec 30 21:40:53 the weird thing is that i just fired up sqlite3 manually on the db file and it read it just fine. Dec 30 21:41:18 what i did was just "rm .android/*" and reinstall it Dec 30 21:41:31 E/PackageManager( 461): Package org.devtcg.rssreader has mismatched uid: 10006 on disk, 10010 in settings Dec 30 21:41:35 oh there it is Dec 30 21:41:37 yeah that Dec 30 21:41:42 what the hell caused that? Dec 30 21:41:51 no-idea Dec 30 21:44:20 so you've noticed this problem specifically with my program and no others? Dec 30 21:44:37 romainguy_: but also, the padding in the list is annoying :) Dec 30 21:44:40 no not your program, it happend with my program Dec 30 21:44:48 oh, ok Dec 30 21:45:22 romainguy_: while i have your attention: Dec 30 21:45:26 http://groups.google.com/group/android-developers/browse_thread/thread/438154ffaafb7113/05d74a65b998021f#05d74a65b998021f Dec 30 21:45:54 didn't you read hackbod's reply? Dec 30 21:46:14 oh no, i'm sorry. i didn't realize anyone had replied yet. Dec 30 21:46:21 :) Dec 30 21:49:45 jasta: actually, it happens when i kill it (in a null pointer exception crash for example) and at the same time launch it (ctrl+f11) from within eclipse Dec 30 21:50:07 yes, i have definitely done that a few times. Dec 30 21:52:18 Lede: hmm, chmod -R ... seemed to fix it. Dec 30 21:52:48 i think you only changed the databse rights Dec 30 21:53:12 now everything can read from it.. Dec 30 21:54:05 err, i meant chown. Dec 30 21:54:22 i chown'd the files to 10010 from 10006, which is what the mismatched logcat line suggested. Dec 30 21:55:07 ha Dec 30 21:55:09 oke nice Dec 30 22:43:43 oh jeez. planning this trip to vancouver island with my girlfriend and just realized that the canadian dollar is officially worth more than the US dollar :( Dec 30 22:43:50 what a sad day Dec 31 00:14:58 Anybody know if theres any special tricks you have to do to modify a listView after its initial render? Dec 31 00:24:04 how do you mean? Dec 31 00:31:00 I mean Dec 31 00:31:10 if i do getListView().removeView(v); it doesn Dec 31 00:31:11 t remove it Dec 31 00:31:21 I imagine its because I have to force it to update somehow Dec 31 00:32:28 I'm not using any ListAdapter.. i imagine thats whats making things so impossibly difficult Dec 31 00:35:52 nothing wors, at all. I've called every function on this thing Dec 31 01:19:04 zgold: what view are you attempting to remove? i think that you do not understand how listview's work :) Dec 31 01:19:22 btw, listview's are supposed to always use an adapter. there is a default one as well Dec 31 01:21:02 Well Dec 31 01:21:13 I have a couple classes which extend different Views which i want to use in the listView Dec 31 01:21:24 you still must use an adapter. Dec 31 01:21:30 and I couldn't think of how to use an adapter with different views ... let alone add to that adapter after the fact Dec 31 01:21:42 OK so even if im using an adapter ( I tried) Dec 31 01:21:49 I still cannot get it to update after its initial layout Dec 31 01:22:07 zgold: you're lost ;) Dec 31 01:22:13 Please find me :) Dec 31 01:22:42 you can have different views in an adapter, so that you tried and failed is not the platform's fault. Dec 31 01:23:00 I just read http://lbellonda.blogspot.com/2007/12/android-how-to-show-items-with.html Dec 31 01:23:11 Which puts different views based on the string; which isn't sufficient in my case Dec 31 01:23:28 what is sufficient, then? Dec 31 01:23:42 I have 3 different types of items which could occur in the list Dec 31 01:23:46 and I only know as they come on what they are Dec 31 01:23:52 come in* Dec 31 01:24:10 2 of the 3 types will only come in during the activity's life cycle Dec 31 01:24:19 define "as they come on" Dec 31 01:24:25 From the network Dec 31 01:24:30 Its an aim client: Groups and buddies Dec 31 01:24:37 ok, so you are adding them dynamically. Dec 31 01:24:50 Correct; and I am unable to get the ListView to refresh Dec 31 01:25:00 this is precisely what listadapters were designed for. Dec 31 01:25:38 I may just be confused; I havn't seen any examples using listadapters more than just on the initial setAdapter call Dec 31 01:26:07 hang on Dec 31 01:26:48 how do you suppose CursorAdapter's work? Dec 31 01:27:06 From what I gathered they work with XML data Dec 31 01:27:12 stuff from ContentProviders I imagine Dec 31 01:27:13 where did you read that? Dec 31 01:27:25 am i mistaken? Dec 31 01:27:30 yes Dec 31 01:27:45 CursorAdapters are driven by Cursor objects, usually the result of a database query. Dec 31 01:28:42 Which is probably why i stopped looking at them. If they're designed to work with the results of sqlite it'd probably be ugly to make it work with recieving data from the network service I have Dec 31 01:29:14 i didn't intend you to do that. i'm saying that do you suppose the CursorAdapter is such that new data cannot be added to the database and then reflected in the list? Dec 31 01:29:33 Thats not how queries have worked with all the databases i've worked with Dec 31 01:29:43 Query once, get a set of tuples, and be done until the next query Dec 31 01:30:47 zgold: managed queries are persistent to the activity, and can be dynamically updated. Dec 31 01:31:13 the contentprovider system is responsible for notifying of changes to data, and the query can be performed again Dec 31 01:32:50 Alright, so assuming I somehow find a way to create my own cursor adapter, have it update from the network data, and still provide different views based also on input from the network; still doesn't explain why the current method doesn't work Dec 31 01:32:58 no, you're missing my point. Dec 31 01:33:10 i'm telling you that you want to use an adapter. Dec 31 01:33:20 but you probably do not want a cursoradapter. Dec 31 01:33:21 Yes, the custom cursor adapter i just mentioned. Dec 31 01:33:34 no, you probably do not want a cursor adapter. Dec 31 01:34:38 So, you recommend an adapter. You also recommend not a cursor adapter. The others I can recall are ArrayAdapter, and SimpleAdapter Dec 31 01:35:02 i recommend you extend ListAdapter. Dec 31 01:35:09 and create your own. Dec 31 01:35:22 polymorphism is a necessary concept when working with this UI toolkit. Dec 31 01:35:27 yes, yes. Dec 31 01:36:09 ListAdapter is a superclass of most of the adapters i just mentioned... its above even BaseAdapter Dec 31 01:36:21 BaseAdapter may also be appropriate, though I am not certain how to interact with a ContentObserver. Dec 31 01:36:22 Why not implement something lower down? Dec 31 01:36:29 like? Dec 31 01:36:39 Any of the previously mentioned. Dec 31 01:36:49 Alright just so i'm clear and not still a confused chicken Dec 31 01:37:03 I can provide an adapter, which I can customize to be linked to whatever data source I chose Dec 31 01:37:23 how can the adapter then signal to its (parent? container?) that it has changed. ListAdapter doesn't seem to have such a function Dec 31 01:37:38 notifyDataChanged() is in BaseAdapter Dec 31 01:38:29 i'm looking right now, and I agree, BaseAdapter may be most appropriate. Dec 31 01:39:28 I'm confused how BaseAdapter does it though; I imagine if baseAdapter calls some function on ListView() I should similarly be able to do it from outside an adapter Dec 31 01:39:33 jasta: what's wrong with using a CursorAdapter? just curious Dec 31 01:39:46 (I do intend to change my code to an adapter nonetheless. Just curious why my current code can't/won't work) Dec 31 01:40:00 jasonlee: It just doesn't seem appropriate for this case. He'd have to either implement his own Cursor type or use an awkward ArrayCursor. Dec 31 01:41:54 jasta: i wrote my own content provider that pulls data off the net, the cursor it returns when queried is an ArrayListCursor, just wondering if there was a better way to do it Dec 31 01:42:34 well, perhaps. the contentprovider approach might make sense if you wish to expose that network data as more than just a library utilized in your application. Dec 31 01:43:55 jasta: i see your point now, thanks Dec 31 01:44:11 otheriwse, i wouldn't think that is appropriate. Dec 31 01:44:28 http://code.google.com/android/samples/ApiDemos/src/com/google/android/samples/view/List8.html actually is useful I think. Perhaps thats the way t go Dec 31 01:44:31 to go* Dec 31 01:45:14 zgold: Yes, I think that is the correct intended usage. Dec 31 01:45:28 Still wish the provided methods would reflect on the view =P Dec 31 01:50:57 how do you mean? Dec 31 01:52:46 i'm trying to see how CursorAdapters do it, but they let you adjust the view based on the contents of the cursor data Dec 31 01:53:19 oh, well, you can just do it based on the position provided by getView Dec 31 01:53:40 you would just manage a relationship between your data and its position in the list Dec 31 01:55:44 Yep, already more than half done. Dec 31 01:56:30 To be completly honest; I think because I hadn't really heard of cursor beind used in this context it kinda scared me off from messing with the adapters. That and I couldn't find any examples of adapters being used to add things dynamically. Dec 31 01:56:53 So i figure'd that was the wrong direction and just did it using getListView.addView() etc. Dec 31 01:57:16 i was the same way, actually. Dec 31 01:57:26 the cursoradapter ocncept is a little alien at first, but it is appropriate. Dec 31 01:57:29 Wow. Dec 31 01:57:32 Thats amazing. Dec 31 01:57:37 what is? Dec 31 01:57:39 Just tested Dec 31 01:57:42 Worked first try Dec 31 01:57:50 thats genuinely shocking Dec 31 01:58:36 my only concern with how changes are propogated is the efficiency of adding and removing views. it must be recycling views meaningfully so as not to put too much stress on the system. Dec 31 01:59:02 Something thats been bugging me which you might know: is there anyway to customize the highlighter in a listview? Dec 31 01:59:05 the yellow bar Dec 31 01:59:15 yes, numerous ways. Dec 31 01:59:16 more or less transparent, different colors etc. Dec 31 01:59:39 I looked and didn't see anything. Didn't put too much effort into it but now that I found you who seems to have much more experience with this than I :) Dec 31 01:59:54 i think that you'd be best of not doing so, though, since you want a consistent user experience. Dec 31 02:00:05 best off* Dec 31 02:00:16 Oh that brings up a good point... I don't see anything here for themeing Dec 31 02:00:27 I use Theme.Dark, which uses that blue selector drawable found in all the demos and such. Dec 31 02:00:39 but you can still even change that, with setSelector() Dec 31 02:00:57 How can you get theme information? I'de love to be theme-compliant Dec 31 02:01:47 zgold: well, you can specify theme as you probably know in the AndroidManifest.xml file, application-wide. Dec 31 02:01:56 to get that themes attributes, in layout XML files you can use: Dec 31 02:02:33 yeah the androidManifest I know.. but don't users like to change themes on the fly? I'm thinking something like Android.getTheme().selectorBackgroundColor() Dec 31 02:02:37 ?android:themeKeyName Dec 31 02:03:44 trying to find where this is in the docs. i know i've sene it before. Dec 31 02:04:23 Is it me or does the Theme.dark selector 100% opaque? Dec 31 02:04:54 I don't know what you mean? Dec 31 02:05:00 why would it be transparent? Dec 31 02:05:05 ah it looks better when setDrawSelectorOnTop(false) Dec 31 02:05:15 with the default theme it looks better with true Dec 31 02:05:21 http://code.google.com/android/reference/available-resources.html#stylesandthemes Dec 31 02:05:24 this is what you want about themes, btw. Dec 31 02:05:55 honestly though, i would stay away from theme stuff until the SDK matures some. i think there are a lot of loose ends in this area. Dec 31 02:05:56 Doesn't seem very dynamic Dec 31 02:06:11 Yeah. I'll just leave things as defaults for now. Dec 31 02:06:18 although I do think i'll keep Theme.Dark Dec 31 02:06:35 Theme.Dark is obviously what Google had intended we use. It's a mystery why it was not the default. Dec 31 02:06:45 everything they wrote uses it. Dec 31 02:06:55 and it looks much better Dec 31 02:06:58 Honestly; themeing within an individual application is dumb Dec 31 02:07:11 Themes should be set globally and everything, all applications, should absorb it Dec 31 02:07:15 damn, you can do a rowspan in a table layout, only a column span Dec 31 02:07:25 I sort of agree, but it makes sense why they provided it. Applications must have the ability to ignore themed attributes if they wish. Dec 31 02:07:42 Eh. I mean yes such a thing is nice and makes devs happy Dec 31 02:07:52 But if we're trying to beat the iPhone in sleekness, that won't do. Dec 31 02:09:43 jasta: I have to run for now, but I can't thank you enough for your help just now. **** ENDING LOGGING AT Mon Dec 31 02:59:56 2007