| Apr 21 |  9:50 AM  | 
| Mark M. | has entered the room  | 
| Mark M. | turned on guest access  | 
| Apr 21 | 10:00 AM  | 
| Suzanne A. | has entered the room  | 
| Mark M. | 
     howdy, Suzanne! 
    
  
   | 
| Suzanne A. | 
     hi mark, good morning 
    
  
   | 
| Suzanne A. | 
     I finished your fragments chapter, tyvm for the great work 
    
  
   | 
| Mark M. | 
     you're very welcome 
    
  
   | 
| Suzanne A. | 
     but someone questioned me on the orientation part, so just want to confirm with you 
    
  
   | 
| Suzanne A. | 
     the paragraph I'm thinking of is on page 389, 
where you describe the limitation of using one layout for a config 
change on the same screen size 
    
  
   | 
| Mark M. | 
     hold on 
    
  
   | 
| Mark M. | 
     ok 
    
  
   | 
| Mark M. | 
     it's an annoying limitation 
    
  
   | 
| Mark M. | 
     what's the specific concern? 
    
  
   | 
| Suzanne A. | 
     ok. so this is where we have one activity hosting several fragments, and the screen rotates on one screen size, right? 
    
  
   | 
| Mark M. | 
     yes 
    
  
   | 
| Suzanne A. | 
     the comment was ... dianne's blog post shows how to change orientation by selecting another fragment to display 
    
  
   | 
| Suzanne A. | 
     but that's across multiple screen sizes, right? 
    
  
   | 
| Mark M. | 
     Dianne is using dynamic fragments, as I recall 
    
  
   | 
| Suzanne A. | 
     yes, exactly 
    
  
   | 
| Suzanne A. | 
     before I argue for you, just want to be sure I have the point right 
    
  
   | 
| Suzanne A. | 
     :) 
    
  
   | 
| Mark M. | 
     the paragraph in question is referring to fragments in the layout resource itself 
    
  
   | 
| Mark M. | 
     i.e., <fragment> elements 
    
  
   | 
| Suzanne A. | 
     right. where I have one layout that defines several fragments, and that layout rotates 
    
  
   | 
| Mark M. | 
     those have to be the same in portrait and landscape for the same screen size, based on my testing 
    
  
   | 
| Apr 21 | 10:05 AM  | 
| Suzanne A. | 
     yes, I get the same result 
    
  
   | 
| Kathy | has entered the room  | 
| Mark M. | 
     however, you can have different lineups of 
fragments in portrait and landscape, so long as the differences are all 
handled via FragmentTransaction 
    
  
   | 
| Suzanne A. | 
     so from a ui perspective, I show two possible solutions 
    
  
   | 
| Mark M. | 
     (which, BTW, is now covered in the Advanced Android book) 
    
  
   | 
| Suzanne A. | 
     do you have an example of the FragmentTransaction approach? 
    
  
   | 
| Mark M. | 
     (also, howdy, Kathy!) 
    
  
   | 
| Suzanne A. | 
     ok, in advanced, I'll check that 
    
  
   | 
| Mark M. | 
     specifically to have different rosters of fragments for portrait vs. landscape, no 
    
  
   | 
| Mark M. | 
     FragmentTransactions in general, yes, in the book update I published yesterday 
    
  
   | 
| Kathy | 
     Hello everone! 
    
  
   | 
| Kathy | 
     View paste
 
    
  
  
 | 
| Mark M. | 
     Kathy: in Android, "screen" is not a term that is typically used 
    
  
   | 
| Mark M. | 
     or, more accurately, it refers to the LCD itself 
    
  
   | 
| Mark M. | 
     I am assuming that you mean "for an entire Activity" 
    
  
   | 
| Mark M. | 
     in which case, the answer is "sorta" 
    
  
   | 
| Mark M. | 
     touch events are handled by widgets first 
    
  
   | 
| Mark M. | 
     if the widget does not consume the touch event, it gets passed to the Activity 
    
  
   | 
| Mark M. | 
     TextView and ImageView do not consume touch 
events, normally, so if your layout is purely those widgets, I would 
expect that your touch events will all get to the activity via 
onTouchEvent() 
    
  
   | 
| fitz | has entered the room  | 
| fitz | 
     morning 
    
  
   | 
| Mark M. | 
     howdy, fitz! 
    
  
   | 
| Apr 21 | 10:10 AM  | 
| Kathy | 
     So I could us onTouchEvent to know it was touched and then write code to do what I want to do next.   
    
  
   | 
| Mark M. | 
     correct 
    
  
   | 
| Mark M. | 
     I have an example of that here: https://github.com/commonsguy/vidtry 
    
  
   | 
| Mark M. | 
     oh, no, wait 
    
  
   | 
| Mark M. | 
     I think I subclassed a widget for the touch events there 
    
  
   | 
| Mark M. | 
     hmmm... 
    
  
   | 
| Mark M. | 
     I'm not sure that I have an example handy of onTouchEvent() at the activity level, among my open source code 
    
  
   | 
| Kathy | 
     Thanks, that helps me a lot. 
    
  
   | 
| Suzanne A. | 
     thanks mark, gotta run - early here.  see you soon. 
    
  
   | 
| Mark M. | 
     fitz: do you have a question? 
    
  
   | 
| Mark M. | 
     Suzanne: see ya! 
    
  
   | 
| Kathy | 
     I want to create buttons that are actual photographs.  Where is the best place to find out info on how to do this?   
    
  
   | 
| Mark M. | 
     Kathy: that depends on what you mean by "buttons that are actual photographs" 
    
  
   | 
| Mark M. | 
     ImageButton is a true Button that allows images on the face, instead of text 
    
  
   | 
| Mark M. | 
     it gives you the beveled edge and visibly responds to touch events with the typical orange flash 
    
  
   | 
| Mark M. | 
     or, you can use plain ol' ImageView 
    
  
   | 
| Mark M. | 
     no order, no orange flash 
    
  
   | 
| Mark M. | 
     but it still responds to android:onClick or setOnClickListener() 
    
  
   | 
| Mark M. | 
     dealing with low-level touch events typically is where you want to do gestures or other stuff 
    
  
   | 
| Mark M. | 
     that's where onTouchEvent() comes in 
    
  
   | 
| Apr 21 | 10:15 AM  | 
| fitz | 
     so did you see my email about tutorial 17, when 
you save the location log and lat it only saves where you are at that 
very moment - do you have an example that reads from the address in the 
record?  
    
  
   | 
| Kathy | 
     What do you mean "no order" for ImageView? 
    
  
   | 
| Mark M. | 
     fitz: that reads what from the address in the record? 
    
  
   | 
| Mark M. | 
     Kathy: oops, sorry, meant "no border: 
    
  
   | 
| Mark M. | 
     or "no border" 
    
  
   | 
| Mark M. | 
     can't type this morning... 
    
  
   | 
| fitz | 
     what I need to look for is an example that would 
read from lets say a contact record there address and basically get a 
map if requested  
    
  
   | 
| Mark M. | 
     as we discussed, there is the Geocoder class in Android, but it seems to be fraught with problems 
    
  
   | 
| Mark M. | 
     if you can settle for the standalone Maps application vs. MapView, there's a URL syntax to bring up a map on an address 
    
  
   | 
| Mark M. | 
     but then you can't draw on it, etc. 
    
  
   | 
| Mark M. | 
     if you need MapView *and* geocoding, either try Geocoder or find another third-party geocoding service to use 
    
  
   | 
| fitz | 
     ok - so nothing that you know of yet for this problem :)    
    
  
   | 
| Mark M. | 
     what specifically is "this problem"? 
    
  
   | 
| fitz | 
     ok - thanks  
    
  
   | 
| fitz | 
     I think mapview for now is fine - will it put a pin on map for target address location?  
    
  
   | 
| Apr 21 | 10:20 AM  | 
| Mark M. | 
     MapView does nothing like that automatically 
    
  
   | 
| Mark M. | 
     that's what the 18-Maps tutorial has code for 
    
  
   | 
| Mark M. | 
     the built-in Maps application might put a marker there -- haven't tried launching it on an address 
    
  
   | 
| fitz | 
     ok - and that uses Geocoder  
    
  
   | 
| Mark M. | 
     if "that" is 18-Maps, no, it uses the location you recorded via GPS from the work you did in 17-Location 
    
  
   | 
| Mark M. | 
     if "that" is the built-in Maps application, who knows what they use 
    
  
   | 
| Mark M. | 
     again, I have never used Geocoder 
    
  
   | 
| Mark M. | 
     ever 
    
  
   | 
| Mark M. | 
     ever 
    
  
   | 
| Mark M. | 
     ever 
    
  
   | 
| fitz | 
     when you say built in - on phone?  if so how does one access this function to see if it would work  
    
  
   | 
| Mark M. | 
     all I see are lots and lots of complaints about it in issues, on StackOverflow, etc. 
    
  
   | 
| Mark M. | 
     yes, I'm referring to the standard Google Maps app
 that's pre-installed on many Android devices (and pretty much all that 
have the Market) 
    
  
   | 
| Mark M. | |
| Mark M. | 
     A geo:0,0?q=my+street+address Uri in an ACTION_VIEW Intent, tossed to startActivity(), should bring up a map on that address 
    
  
   | 
| fitz | 
     ok thanks - off again to look into more stuff - will stay here to observe more... 
    
  
   | 
| Kathy | |
| Mark M. | 
     that depends on what you mean by "affected" 
    
  
   | 
| Mark M. | 
     the size of the ImageView will be dictated by 
however you define it in your layout, and that could be dependent upon 
screen size (e.g., using android:layout_weight with a LinearLayout) 
    
  
   | 
| Kathy | 
     Do I need to be concerned with the different screen sizes when using ImageView? 
    
  
   | 
| Mark M. | 
     generally, yes 
    
  
   | 
| Mark M. | 
     though density is more important 
    
  
   | 
| Mark M. | 
     it depends on how you are using the widget 
    
  
   | 
| Mark M. | 
     if you are trying to have the image stretch or shrink to fill a particular space, screen size matters 
    
  
   | 
| Apr 21 | 10:25 AM  | 
| Mark M. | 
     if you are setting the ImageView's size to 
wrap_content on both axes, screen size will only matter if your image is
 bigger than the available resolution 
    
  
   | 
| Kathy | 
     I am thinking of using it more like a button. 
    
  
   | 
| Mark M. | 
     that doesn't tell me much 
    
  
   | 
| Kathy | 
     It would be a small button, and would not be larger that the available resolution. 
    
  
   | 
| Mark M. | 
     again, the issue is whether the button is resizing to fit the image, or if the image is resizing to fit the button 
    
  
   | 
| fitz | 
     Mark do you have a bunch of code at github that is not on books?  is there a listing of the tools at github?  
    
  
   | 
| fitz | 
     on books = in books  
    
  
   | 
| Mark M. | |
| Mark M. | 
     that's my list of public repositories 
    
  
   | 
| Apr 21 | 10:30 AM  | 
| Mark M. | 
     cw- ones are tied to books 
    
  
   | 
| Mark M. | 
     cwac- ones are the CommonsWare Android Components, reusable widgets and libraries and such 
    
  
   | 
| Suzanne A. | has left the room   | 
| fitz | 
     nice thanks  
    
  
   | 
| Mark M. | 
     the rest are a hodge-podge 
    
  
   | 
| Dimitri | has entered the room  | 
| Kathy | 
     View paste
 
    
  
  
 | 
| Mark M. | 
     howdy, Dimitri! 
    
  
   | 
| Dimitri | 
     Hi Mark, 
    
  
   | 
| Mark M. | 
     Kathy: TableLayout can handle the tree wide/eight deep part 
    
  
   | 
| Dimitri | 
     View paste
 
    
  
  
 | 
| Mark M. | 
     however, it is not intrinsically "selectable", so you'd have to handle that yourself 
    
  
   | 
| Mark M. | 
     GridView can handle the three wide/eight deep part and has selection logic 
    
  
   | 
| Mark M. | 
     however, depending on what you mean by "fade animation", that may or may not work well with an AdapterView 
    
  
   | 
| Mark M. | 
     either way, I think you have a bit of work to do :-) 
    
  
   | 
| Mark M. | 
     Dimitri: #1: ideally use setInexactRepeating(), if that'll work for your use caes 
    
  
   | 
| Mark M. | 
     er, case 
    
  
   | 
| Mark M. | 
     #2: Yes, so please do the work in an IntentService or something 
    
  
   | 
| Mark M. | 
     #3: don't use a _WAKEUP alarm 
    
  
   | 
| Kathy | 
     I know what you mean and am thinking of trying something different.  What if I just put buttons in the table or grid? wanf  d 
    
  
   | 
| Mark M. | 
     Kathy: Button widgets in a TableLayout are fine 
    
  
   | 
| Mark M. | 
     Buttons inside individual pieces of an AdapterView (rows in a ListView, cells in a GridView) get tricky 
    
  
   | 
| Apr 21 | 10:35 AM  | 
| Dimitri | 
     Also, I'm using a BOOT_INTENT to start an alarm 
that will do some file cleanup every 24hr... But how do I start the 
alarm after the app has been installed (should I ask the user to reboot 
the phone? :) ) 
    
  
   | 
| Kathy | 
     Would ImageViews work better in a grid? Would I know which one was selected in the grid? 
    
  
   | 
| Mark M. | 
     Dmitri: just register your alarm on the first run of your app -- there's nothing to clean up before then anyway 
    
  
   | 
| Mark M. | 
     Kathy: GridView and ImageViews work well together.
 You would register an OnItemSelectedListener with the GridView to find 
out about selection events. 
    
  
   | 
| Mark M. | 
     Note, though, that "selection" in Android has a specific meaning and is *not* tied to the touchscreen 
    
  
   | 
| Mark M. | 
     "selection" is for D-pad, trackball, arrow keys, etc. 
    
  
   | 
| Dimitri | 
     Thanks a lot for the advices Mark! :) 
    
  
   | 
| Mark M. | 
     if you really mean "click", you would find out about click events via an OnItemClickListener registered with the GridView 
    
  
   | 
| Kathy | 
     Okay, using OnItemClickListener would tell me which ImageView had been clicked in the grid?  
    
  
   | 
| Mark M. | 
     yes 
    
  
   | 
| Apr 21 | 10:40 AM  | 
| Dimitri | 
     Mark: do you have an example in your book about IntentService? 
    
  
   | 
| Mark M. | 
     Sure 
    
  
   | 
| Mark M. | 
     several, in fact 
    
  
   | 
| Mark M. | 
     it's covered in the services chapters of The Busy Coder's Guide to Android Development 
    
  
   | 
| Mark M. | 
     it's also used in some of the advanced services stuff in The Busy Coder's Guide to Advanced Android Development 
    
  
   | 
| Mark M. | 
     and it gets used in Tutorial #16 of Android Programming Tutorials 
    
  
   | 
| Dimitri | 
     Thanks, I'll look into it :) 
    
  
   | 
| fitz | 
     mark do you have examples of how to query the 
contacts in app - as in I want to see all contacts I have an a specific 
city I am visiting next week  
    
  
   | 
| Mark M. | 
     not like that 
    
  
   | 
| Apr 21 | 10:45 AM  | 
| Mark M. | 
     the Advanced Android book shows loading contacts, but not based on address 
    
  
   | 
| Mark M. | 
     that would be difficult to do with accuracy, depending on how literal you want "a specific city" to be 
    
  
   | 
| Mark M. | 
     (e.g., does an outlying suburb count?) 
    
  
   | 
| Kathy | 
     Thanks for all of the help Mark. 
    
  
   | 
| Mark M. | 
     sure! 
    
  
   | 
| Apr 21 | 10:55 AM  | 
| fitz | 
     txs Mark have a great day  
    
  
   | 
| Mark M. | 
     you too! 
    
  
   | 
| fitz | has left the room  | 
| Apr 21 | 11:00 AM  | 
| Dimitri | has left the room   | 
| Mark M. | 
     have a pleasant day, all! 
    
  
   | 
| Kathy | has left the room   | 
| Mark M. | turned off guest access  |