Office Hours — Today, April 2

Thursday, March 28

Apr 2
9:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
10:00 AM
Kadrov N.
has entered the room
Kadrov N.
Hi
Mark M.
hello, Kadrov!
how can I help you today?
Kadrov: do you have a question?
Kadrov N.
Do you know any easy to implement ways to make gift codes system for application? My application is free with in-app purchase for unlocking PRO version.
Mark M.
sorry, but I have never used the in-app purchasing system
Kadrov N.
I need this functionality to say thanks to my beta testers
10:05 AM
Mark M.
you might try asking this on StackOverflow, or if there is a Google Group dedicated for the in-app purchasing stuff
Kadrov N.
ok, thanks
Mark M.
sorry that I could not be of greater help on that question
if you have other questions (not related to in-app purchases), feel free to ask -- nobody else is in the chat room presently
10:20 AM
Kadrov N.
has left the room
10:45 AM
Andrew G.
has entered the room
Mark M.
hello, Andrew!
how can I help you today?
Andrew G.
hi Mark
nowt too crowded today eh? :)
Mark M.
another person was here earlier and left
10:50 AM
Mark M.
otherwise, yes, rather quiet
Andrew G.
qjuick question, I am finally getting around to implementing my dialogs as Fragments
I'm setting up a custom DialogFragment since I want to make the layout appear a certain way
The dialog just consists of a TextView that I have styled appropriately
Mark M.
meaning that you are using onCreateView()? or are you still creating a Dialog in onCreateDialog()?
Andrew G.
onCreateDialog since I'm subclassing SherlockDialogFragment
so from onCreateDialog I inflate the XML and set it up etc
Mark M.
FWIW, onCreateView() still works with SherlockDialogFragment AFAIK -- the resulting View is wrapped in a generic Dialog
Andrew G.
problem is, after that creation, I need to set some new text in that text field from outside the class
Mark M.
but your approach should be fine
Andrew G.
I can't get a handle to it by any way I've tried
Mark M.
you inflated the layout
just find the TextView there and hold onto it in the SherlockDialogFragment
(though you will need to watch out for configuration changes, making sure you get the fresh TextView if/when the dialog is re-created)
Andrew G.
well, right now the TextView is local to the inner class (DialogFragment child)
doesn't have to be that way but can I just refer to it directly after I inflate it or do I have to do getFragment().findById?
10:55 AM
Mark M.
there is no findById() on the fragment IIRC
you can call getDialog().findViewById() on your DialogFragment, though
leastways, that should work -- haven't tried it
Andrew G.
yeah I have tried the getDialog().findViewById() route but get a null back
Mark M.
that's odd
then I'd roll back to trying to hold onto the TextView after inflation
Andrew G.
Honestly I don't fully understand the diferences between manually inflating with a Layoutinflator vs using the findVyewById of the root
Mark M.
those are apples and oranges
inflating a layout *creates* Views
findViewById() *retrieves* Views that somebody else created, perhaps via inflation
Andrew G.
by specifying a layout in the xml - do you need to inflate those layouts or are they considered already inflated?
I feel like I never use the LayoutInflator
Mark M.
somebody, somewhere, is inflating layout XML resources
setContentView(), for example, uses LayoutInflater under the covers
Andrew G.
ah
that was the key I was missing
Mark M.
yeah, any time there is a layout XML resource, somebody is using LayoutInflater
Andrew G.
so if I wanted to do things with a laout specified in a different xml file (not the one set as content view) I'd have to inflate them myself
11:00 AM
Mark M.
yes, such as having a very fancy Adapter where you have different row structures for different types of items
Andrew G.
gotcha
I will tinker with this DialogFragment a bit more and if I have issue I'll try to be in next time earlier
Mark M.
OK
Andrew G.
thanks Mark
Mark M.
the next chat is Thursday, 10am Eastern
Andrew G.
gotcha
Mark M.
this chat's transcript will be archived on http://commonsware.com/office-hours/ shortly
have a pleasant day!
Andrew G.
has left the room
Mark M.
turned off guest access

Thursday, March 28

 

Office Hours

People in this transcript

  • Andrew G
  • Kadrov Nikita
  • Mark Murphy