Questions tagged [android-listfragment]

ListFragment is one of the specialized Fragment classes which has, by default, a ListView as its content view.

ListFragment is one of the specialized Fragment classes which has, by default, a ListView as its content view. The ListFragment can be customized as desired but a ListView with the id android.R.id.list(or android:id="@android:id/list" for an xml layout) must be present in the content view used for the ListFragment. The methods that are present in a ListActivity (like getListView() and setListAdapter()) are available in a ListFragment.

More information about the ListFragment can be found in its documentation.

1175 questions
6
votes
2 answers

Android: cannot refresh Listview using CustomAdapter

I need to refresh the list view with new data. This code below is used to obtain data in OnCreateView that is in FragmentActivity at the first time. override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, …
6
votes
1 answer

using bundle to pass data between fragment to another fragment example

I have 3 sherlockListFragments in my app. Every fragment has some editTexts and the last fragment has a button which when it's pressed all data in the first and second fragments should be accessed and stored. I used bundle to send data between…
Fareed
  • 540
  • 2
  • 7
  • 23
6
votes
2 answers

Android - ListFragment inside DialogFragment(AlertDialog): Fragment does not have a view

I'm trying to create a DialogFragment with a ListFragment nested inside of it. I'm using the nested fragment that was added in the 4.2.2 I'm using it with support library so my api version shouldn't matter (for the record, my os version is also…
6
votes
4 answers

Handle Fragment duplication on Screen Rotate (with sample code)

There are some similar answers, but not to this situation. My situation is simple. I have an Activity with two different layouts, one in Portrait, another in Landscape. In Portrait, i use and add Fragment into it dynamically. In…
6
votes
1 answer

How do I properly initiate a multi-select Contextual Action Bar for ListFragment (having issues)

I have a ListFragment associated with a simple ArrayAdapter. The ListView holds a list of checkable items and its XML layout is as follows:
6
votes
2 answers

onCreateOptionsMenu called before onCreate android

I am beginner to android and i am developing small android application. In my application I am using Sherlock library. My application contains one main activity and two fragments. On of my list fragment structure looks like public class MyCards…
6
votes
2 answers

How to set the Divider (to null) of a ListFragment custom layout

I'm trying to understand how to work with listfragments and custom adapters. So I build this little example and I was wondering where I could set the divider of my listview to null. I found different ways: - android:dividerHeight="1dip" -…
Lokkio
  • 1,653
  • 2
  • 16
  • 19
6
votes
1 answer

Android ListFragment list view overlapping on orientation change

I'm using ListFragment and implementing LoaderManager.LoaderCallbacks from Android compatibility package for showing a list view in the app. The list is showing fine but when orientation changes, the list view is not proper (I think the view is…
Gautham
  • 2,962
  • 2
  • 24
  • 38
6
votes
3 answers

how to display custom listview using list fragments in android

I have divided my android screen into 2 fragements .In the first one I make a listview from server database to android mobile.The problem is that I can't call getview method in the base adapter class. Do help me out public class MyListFragment1…
naveen
  • 651
  • 3
  • 11
  • 16
5
votes
1 answer

The screen dims but the dialog doesn't show up

I have created a list inside a Fragment using an Adapter. I want to display a different dialog for each one of the items in the list when it is clicked. I have added the listener to the list items and written the code for the dialog to appear for…
5
votes
2 answers

SwipeRefreshLayout -Attempt to invoke virtual method on a null object reference

I try to realize a ListFragment with refresh his content by pulldown with the SwipeRefreshLayout My Code is public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); …
Stevetro
  • 1,686
  • 2
  • 12
  • 22
5
votes
2 answers

How to get context of an activity extending ListFragment from its adapter class?

This is my adapter class where I want to call startActionMode. I call it inside setActionMode method but got these errors: Cannot cast from Context to ActivityFragment. The method startActionMode(ActivityFragment.ActionModeCallback) is undefined…
5
votes
5 answers

increase ListFragment inbuilt empty text view size

I m using listfragment in my app. When the data fails to load I call setEmptyText with the failure message. This works fine on 4 inch phones but on 7 and 10 inch phones the size of the empty textview is very small and hard to read. 4 inch empty text…
Vihaan Verma
  • 11,446
  • 17
  • 84
  • 120
5
votes
0 answers

How to change fragment programmatically on FragmentPagerAdapter?

I have created applicaiton by using Eclipse default ViewPager application parameters. Main activity contains 2 tabs(tabA and tabB). Each tab refers to its fragment(fragmentA and fragmentB). public class SectionsPagerAdapter extends…
5
votes
3 answers

Setting the background color of ListView items on Button click

I have a FragmentActivity that can contain as many ListFragments as a user wants. The ListFragments are laid out side-by-side (upon choosing an option in the ActionBar) inside a HorizontalScrollView. Each ListFragment item contains a TextView and a…
user1841702
  • 2,163
  • 4
  • 30
  • 49
1 2
3
78 79