Hello all,

I am writing my first fully fragment-based app, which should show
multiple master/detail levels, basically as the google mail app does.
I did not find any applicable examples online, and my experiments so
far have failed, so I am asking this here:

My app is currently only targeting tablets with the ability to show
multiple fragments. It basically navigates 2 trees, switching between
the trees via tabs. Each tree has multiple levels, of which I want to
show 2 at a time. On the left side, there will be the usual list, and
on the right side there will be either some kind of list (if the leaf
level has not been reached), or some kind of leaf detail page.

My understanding so far is, that I will have to manage the position in
the tree, and the display of the appropriate fragments. This means the
activity will replace the fragment (remove + add) for the current
detail level, and reinitialize the left list fragment with new
content.

I started out by creating a layout XML with 2 fragments. I then went
on trying to replace them with other fragments when switching tabs.
With this, I get very strange results. When removing the details
fragment and adding a new one, the removed one still shows on screen.
When removing the left list fragment, I get a NullPointerException in
a paint routine that queries the removed list fragment for its
activity, which is null.

My question: is my overall approach correct? What am I doing wrong?
Can XML-based fragment layouts be manipulated in code via
fragmentTransaction? Does anyone know sample code for the kind of
scenario I am describing?

thanks in advance,
chris

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to