Office Hours — Today, August 16

Tuesday, August 14

Mark M.
has entered the room
Mark M.
turned on guest access
Aug 16
10:05 AM
Samuel
has entered the room
Mark M.
howdy, Samuel!
how can I help you today?
Samuel
Hi Mark
I develop an activity that consist of 2 framelayout for fragment A and fragment B. Fragment B will call fragment C. Is it possible to use layout of fragment B as container of fragment C?
Mark M.
that depends on what you mean by "layout of fragment B"
if you mean "the FrameLayout that holds fragment B", a replace() transaction can replace fragment B with fragment C
if you mean "something inside fragment B", fragments cannot be nested, so this will not work reliably
Samuel
I think the replace() is the best. Thanks
I'll try it
10:10 AM
Samuel
View paste
I have one more question when trying to modify the tabwidget. I create the following style <style name="customTabWidget" parent="@android:style/Widget.Holo.TabWidget"> that has this item <item name="android:tabLayout">@android:layout/tab_indicator_holo</item>
But I got this error : No resource found that matches the given name: attr 'android:tabLayout'
10:15 AM
Mark M.
then there is no android:tabLayout attribute, apparently
I have not attempted using it and cannot comment as to whether or not it exists, or exists for all API levels
Samuel
Okay, thank you. I think it's enough for now. Good bye
Samuel
has left the room
10:20 AM
Prasanna
has entered the room
Prasanna
Hi Mark
How are you today?
Mark M.
howdy, Prasanna!
how can I help you?
Bruce F.
has entered the room
Prasanna
I am using a Spinner that is populated from an ArrayAdapter. I want to have the Spinner say 'Select X'. But when you click on the Spinner the expanded list should not have this 'Select X'. The expanded list should only have the values that can be selected. How do I do this?
Mark M.
AFAIK, you don't
or you create your own subclass of Spinner, perhaps, that has this behavior
Spinners always have a selection, and that selection is always from its adapter
Prasanna
Not sure what you mean by AFAIK
Mark M.
AFAIK = as far as I know
Prasanna
oh ok
Mark M.
you *might* be able to create a tricky adapter that can somehow handle this, but I have not tried it and do not know if it could be made to work
Prasanna
hmmm ok
what I am trying to do is ...
I have several spinners on the screen
The 2nd Spinners values are dependent on the 1st Spinners selected value
10:25 AM
Prasanna
And I do not want to show the 2nd Spinner until the 1st Spinner ..
value is selected
That is whey i have 'Select X' in as the 1st value of the 1st Spinner
So that when a value is selected on the 1st Spinner
I can show the 2nd Spinner with the appropriate values.
Any thoughts on how I can implement this?
Mark M.
I wouldn't implement that
and I have no good idea how you would
Prasanna
so to take the user through a series of selections that depend on the previous selection ...
what is a good way to do this in Android?
Mark M.
for a two-tier structure, use an ExpandableListView
for more than two tiers, use an ExpandableListView followed by another activity/fragment that uses a ListView or another ExpandableListView
Prasanna
how is ExpandableListView different from ListView
10:30 AM
Mark M.
think of it as a two-tier "tree" widget
groups and children
Prasanna
do you have an example in the Busy Coder
Mark M.
I am adding ExpandableListView to the Widget Catalog in the next version, due out around September 1st
Prasanna
ok. I have about 4 tiers ...
So when the user selects the 2nd tier in the 1st ExpandableListView I will have to take them to another activity/fragment?
Mark M.
yes
Prasanna
ok. Any ideas on where I can find a good example now on ExpandableListView?
Mark M.
there should be stuff in the SDK's ApiDemos
Prasanna
ok
Thanks Mark!
10:35 AM
Prasanna
Good luck with all of your speaking engagements. Heading out. Have a great day!
Mark M.
you too!
Prasanna
has left the room
Bruce F.
Howdy Mark.
Mark M.
howdy, Bruce!
Bruce F.
Based on your advice, I looked into using SpannableStringBuilder and Html.fromHtml() to format text for a button. But I’d like to lay out the depart and return buttons on the Kayak app. I’ll upload a screen capture of what I’d like to accomplish:
Mark M.
sorry I missed your arrival
Bruce F.
If <table> was supported, I’d have a clue…
Mark M.
I suspect that those are not Button widgets
AFAIK you could apply the Button background resource to something else and work out the events to ensure that it changes state appropriately on clicks
10:40 AM
Mark M.
another possibility is that they are empty Button widgets into which they are drawing themselves, perhaps via a subclass, with custom Canvas logic
but, yeah, I don't think the Html.fromHtml() trick can handle this scenario
Bruce F.
So would a TextView work?
Mark M.
individually, no -- Button inherits from TextView
per my first suggestion, that could conceivably by a TableLayout, nested LinearLayouts, or a GridLayout, with multiple TextView widgets, and a Button-style background on the container
what makes a Button be a Button is mostly the background resource, a StateListDrawable
I have not tried this, so I am presuming that it would work
Bruce F.
So I could apply Html.fromHtml() to three separate TextViews, and wrap them in a layout?
Mark M.
well, you would not need Html.fromHtml() to mimic what you see there in Kayak, but otherwise yes
Bruce F.
Yeah, that just occured to me.
Thanks
10:45 AM
Bruce F.
One more...
Still trying to get imeOptions =”actionNext” functionality for my two line EditText. Tried if(actionId == EditorInfo.IME_ACTION_NEXT), but in debug, the value of actionId appears to be 0 every single time regardless. Then, with secondEditText being where I want to transfer focus, I tried secondEditText.requestFocus(). Appears to have no effect. And secondEditText is focusable. Tried an InputFilter, but that just limits the number of characters, and doesn’t transfer focus. Any ideas?
Mark M.
refresh my memory: is your problem when clicking the action button, when pressing Enter on the 2nd line, or both?
Bruce F.
After entering one or two lines of text and pressing Enter, it appropriately moves to the next EditText in 2.1, does not in other versions I've tested.
Mark M.
well, in the Enter scenario, since you are not clicking on the action button, I am not surprised that actionId is 0
in the one case where I have a single-line EditText, I use if (event == null || event.getAction() == KeyEvent.ACTION_UP)
Bruce F.
thanks, I'll check that.
10:50 AM
Bruce F.
One more... I remember seeing somewhere that after the user clicks on the share icon, it can be configured to display the most common or recent share resource. But now I can't find any info on it. Can you direct me?
in the action bar that is.
Mark M.
ShareActionProvider, IIRC
specifically setShareHistoryFileName()
or skip that to use a common history
Bruce F.
Great, I'll check it out.
Thank you again.
Bye.
Bruce F.
has left the room
10:55 AM
Mark M.
turned off guest access

Tuesday, August 14

 

Office Hours

People in this transcript

  • Bruce F
  • Mark Murphy
  • Prasanna
  • Samuel

Files in this transcript