Mark M. | has entered the room |
Mark M. | turned on guest access |
Gabriele | has entered the room |
Mark M. |
howdy, Gabriele!
|
Gabriele |
Hello
|
Mark M. |
how can I help you today?
|
Gabriele |
today I'm here with the ide! I'm still confused with the webviewfragment not showed hm
|
Gabriele |
you told me to check if with the hierarchy tool I can see the webview, right?
|
Mark M. |
yes
|
Gabriele |
What do you mean exactly? I see Fragment -> WebViewFragment -> WikiFragment
|
Mark M. |
you will not see any of those in Hierarchy View
|
Mark M. |
Hierarchy View only shows widgets and containers, not fragments
|
Mark M. |
Hierarchy View is a separate perspective in Eclipse, or a standalone tool
|
Gabriele |
Ah maybe because I'm in intellij
|
Mark M. |
yes, I do not know if they have Hierarchy View integrated or not
|
Nov 20 | 4:00 PM |
Mark M. | |
Mark M. |
(though the instructions there are a bit out of date -- run the monitor command, not hierarchyviewer)
|
Gabriele |
oh nice
|
Gabriele |
no, here I don't see any webview :/
|
Gabriele |
maybe the problem is I didn't loaded it then hm
|
Mark M. |
do you see whatever container your fragment is in?
|
Gabriele |
load*
|
Gabriele |
no I don't see any of my fragments
|
Mark M. |
do you see the, um, ViewPager, or whatever the container was?
|
Gabriele |
yes I see the viewpager
|
Gabriele |
but no fragments inside it
|
Mark M. |
does that correspond with what you see live, that you cannot swipe between pages?
|
Nov 20 | 4:05 PM |
Gabriele |
I can swipe between pages, but I can't see the webview
|
Gabriele |
should I use getSupportFragmentManager().beginTransaction().add() to load the webview?
|
Mark M. |
OK, that means that there must be some children of the ViewPager in Hierarchy View
|
Gabriele |
yes I have two textview
|
Gabriele |
Wikipedia (which should contain the webview) and Bookmarks
|
Mark M. |
does your ViewPager use an indicator, like PagerTitleStrip?
|
Gabriele |
yes
|
Mark M. |
OK, so the TextViews then are your title strip
|
Mark M. |
are there any other children of the ViewPager?
|
Gabriele |
pagertabstrip
|
Gabriele |
no, there aren't
|
Mark M. |
that means that neither of your fragments are being loaded properly, then, for some reason
|
Mark M. |
there should be the view from one of those two as a child of the ViewPager, I would expect
|
Gabriele |
hm I think I didn't load them then, should I load them with getSupportFragmentManager().beginTransaction().add()?
|
Mark M. |
no, because FragmentPagerAdapter does that
|
Gabriele |
ah :(
|
Mark M. |
I have a few samples of fragments in ViewPagers in the book
|
Gabriele |
my getItem is ok? (do you still have the github access?)
|
Gabriele |
the file is MyPagerAdapter.java
|
Mark M. |
hold on
|
Nov 20 | 4:10 PM |
Mark M. |
I suggest that you delete isViewFromObject()
|
Mark M. |
you should not need that, and it might be interfering
|
Mark M. |
otherwise, what you have there should work
|
Mark M. |
the fact that you are getting your page titles indicates that you are successfully putting the adapter in the ViewPager
|
Mark M. |
so, other than isViewFromObject(), I cannot explain why you would not see either of your fragments' contents
|
Gabriele |
hm I've removed it
|
Gabriele |
Ok, something better, it seems
|
Gabriele |
I can see the listview inside bookmarks now
|
Gabriele |
but no webview, still!
|
Mark M. |
swipe over to the WebView, then refresh your Hierarchy View for your activity
|
Gabriele |
hm still no webview
|
Nov 20 | 4:15 PM |
Mark M. |
set some breakpoints in onCreateView() of WikiFragment and walk through it, I guess
|
Gabriele |
I've put it inside onCreateView, but it never get called (on getWebView().setWebViewClient(new MyWebViewClient());)
|
Mark M. |
is the WikiFragment actually being created and returned by MyPagerAdapter, then?
|
Gabriele |
let's see, f = WikiFragment.newInstance(); is reached
|
Nov 20 | 4:20 PM |
Mark M. |
hmmm, there's no assignment in your code on GitHub, it's just return WikiFragment.newInstance();
|
Gabriele |
ah yes, I've changed it, but it's the same, now it
is Fragment f = WikiFragment.newInstance(); and then after the switch
return f;
|
Gabriele |
I will change back in a moment
|
Mark M. |
what you have there sounds fine -- I was just pointing out that it wasn't what I'm seeing
|
Gabriele |
oh no!
|
Gabriele |
now it's working
|
Gabriele |
so my new assignment did a new damage!
|
Gabriele |
View paste
|
Gabriele |
shouldn't it be the same?
|
Mark M. |
it looks like it should be OK
|
Mark M. |
OTOH, it is difficult to argue with working code
|
Gabriele |
what does otoh means? :P
|
Mark M. |
on the other hand
|
Gabriele |
ah, thank you
|
Mark M. |
it is YAIA (yet another Internet acronym)
|
Gabriele |
it seems that the problem on my switch
|
Gabriele |
is that I didn't use the break after case 0
|
Gabriele |
but I can't understand why
|
Mark M. |
ah!
|
Mark M. |
good catch
|
Nov 20 | 4:25 PM |
Gabriele |
why case 1 is always executed? hm
|
Mark M. |
well, case 0 falls through to case 1
|
Mark M. |
because of the missing break
|
Gabriele |
ah, true
|
Mark M. |
and, since you are assigning the value now, the case 1 assignment wipes out the case 0 assignment
|
Mark M. |
whereas before, you were returning immediately from the case 0
|
Gabriele |
yes
|
Gabriele |
so the old problem was the one you find
|
Gabriele |
and the new one the break
|
Gabriele |
and why isViewFromObject made this problem?
|
Mark M. |
that is something you do not need to override on FragmentPagerAdapter or FragmentStatePagerAdapter
|
Mark M. |
you do need to implement it on your own custom PagerAdapter
|
Gabriele |
ah
|
Gabriele |
another question, a thing I don't understand
|
Gabriele |
the support library... I thought it was for back-compatibility projects
|
Mark M. |
some things in the Android Support package are backports, yes
|
Mark M. |
not everything
|
Gabriele |
so I thought "I can try to build a new project without back compatibily" but then I've noticed that there is not viepwager ect.
|
Mark M. |
such as ViewPager
|
Gabriele |
exaclty!
|
Gabriele |
why this decision?
|
Mark M. |
the Android Support package is "code that Google is giving us and is supporting but is in no Android OS"
|
Gabriele |
ah, I see
|
Nov 20 | 4:30 PM |
Mark M. |
partly, they can update the Android Support package without OTA updates to hundreds of millions of devices
|
Mark M. |
partly, it helps keep the firmware size down, which helps keep the cost of Android devices down
|
Gabriele |
how do they update it?
|
Mark M. |
through the SDK Manager
|
Mark M. |
developers opt into using newer versions as part of building their apps
|
Mark M. |
for example, they just shipped a new version when they shipped Android 4.2 and the R21 tools release a week ago
|
Gabriele |
Ah, so when I'm developing with the new version and I publish the app on the playstore, it will packed inside my app?
|
Mark M. |
yes
|
Gabriele |
because it's a library, nice
|
Mark M. |
just like any other JAR
|
Gabriele |
the name was confusing me, probably
|
Mark M. |
it used to be called the Android Compatibility Library (ACL) and only had backports
|
Mark M. |
they then added ViewPager to it
|
Mark M. |
I grumbled about the name then, and some time later, they renamed it to the Android Support packager
|
Mark M. |
er, package
|
Mark M. |
(though I doubt my grumbling had much to do with their decision to change it)
|
Gabriele |
eheh, maybe it did!
|
Gabriele |
ok, thank you very much, I don't have question anymore, at least for today :P
|
Mark M. |
OK
|
Nov 20 | 5:00 PM |
Gabriele |
See you the next time, thank you again.
|
Nov 20 | 5:00 PM |
Gabriele | has left the room |
Mark M. | turned off guest access |