android-fragments
Long click on ListFragment
Yes, the solution posted by tsync works for me. I too had ran into same problem and considered that this is not possible. I tried the above suggestion as follows: public class ProjectsFragment extends ListFragment { @Override public void onActivityCreated(Bundle savedState) { super.onActivityCreated(savedState); getListView().setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, … Read more
3 android fragments in viewpager, how to keep them all alive?
use setOffscreenPageLimit(int limit) on the ViewPager object. From the documentation: [It set]s the number of pages that should be retained to either side of the current page in the view hierarchy in an idle state.
Best place to addHeaderView in ListFragment
I don’t know if you have solved your problem but here is a solution that worked for me: Do not call ListFragment.setListAdapter() in your ListFragment.onCreate(). Make sure you have a field variable that can hold the header view, maybe like: View mheaderView; Then in your ListFragment.onCreateView(), inflate the header View and assign it to your … Read more
Retained Fragments with UI and memory leaks
In a Fragment with UI you often save some Views as instance state to speed up access. For example a link to your EditText so you don’t have to findViewById it all the time. The problem is that a View keeps a reference to the Activity context. Now if you retain a View you also … Read more