android-listfragment

commit fragment from onLoadFinished within activity

半世苍凉 提交于 2019-11-30 09:09:56
I have an activity which loads a data list from the server using loader callbacks. I have to list out the data into a fragment which extends SherlockListFragment i tried to commit the fragment using Fragment newFragment = CategoryFragment.newInstance(mStackLevel,categoryList); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(R.id.simple_fragment, newFragment).commit(); in onLoadFinished and it gives an IllegalStateException saying java.lang.IllegalStateException: Can not perform this action inside of onLoadFinished I have referred the example in actionbar

Replace ListFragment with Fragment inside ViewPager with Tabs

為{幸葍}努か 提交于 2019-11-30 07:52:45
I try to setup following navigation in my app: Actual condition: ViewPager + Tabs to swipe between lists: ListFragment A ListFragment B Desired condition: ViewPager + Tabs: ListFragment A onListItemSelected replace ListFragment A with DetailFragment A ListFragment B onListItemSelected replace ListFragment B with DetailFragment B The goal is to display the detail fragments inside the tab navigation. I can't replace the fragmentList by a detailFragment (the fragmentList has no custom layout and therefore no ID AND i don't know how to do it). Also, starting a new activity hides the tab bar. Can

How to execute action after DialogFragment positive button clicked

一笑奈何 提交于 2019-11-30 07:23:39
I created the following DialogFragment deriving it from the Android documentation: public class PayBillDialogFragment extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState){ final Bundle b = this.getArguments(); // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("Paga bollettino") .setPositiveButton("Paga", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // FIRE ZE MISSILES! } }) .setNegativeButton("Cancella", new

Android refresh a fragment list from its parent activity

元气小坏坏 提交于 2019-11-30 04:53:42
I have a main activity which contains the action bar with 3 menu buttons in it. I then have a fragment within this main activity which has a list. I would like to be able to refresh the list in the fragment from the main activity, when one of the menu buttons is clicked, or preferably just removed all the rows from the list. Any help is appreciated. Thanks. public class Favourite extends SherlockFragmentActivity { ActionBar actionBar; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.favourite); actionBar = getSupportActionBar();

commit fragment from onLoadFinished within activity

余生颓废 提交于 2019-11-29 13:50:53
问题 I have an activity which loads a data list from the server using loader callbacks. I have to list out the data into a fragment which extends SherlockListFragment i tried to commit the fragment using Fragment newFragment = CategoryFragment.newInstance(mStackLevel,categoryList); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(R.id.simple_fragment, newFragment).commit(); in onLoadFinished and it gives an IllegalStateException saying java.lang.IllegalStateException

How to execute action after DialogFragment positive button clicked

白昼怎懂夜的黑 提交于 2019-11-29 09:33:22
问题 I created the following DialogFragment deriving it from the Android documentation: public class PayBillDialogFragment extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState){ final Bundle b = this.getArguments(); // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("Paga bollettino") .setPositiveButton("Paga", new DialogInterface.OnClickListener() { public void

Fast scroll large letter thumb preview not appearing

余生长醉 提交于 2019-11-29 08:50:59
I'm trying to get the fast scroll pop up containing the large letter to appear when I the fast scroll feature in my list (just like in the image below), but for some reason it won't appear. I've consulted various tutorials but it still doesn't seem to work + I'm not sure if code is missing or some code is in the wrong place. All help would be appreciated. strings.xml <resources> <string name="app_name">World</string> <string name="action_search">Search</string> <string name="search_hint">Continent name</string> <string name="item0">Azerbaijan</string> <string name="item1">Bosnia & Herzegovina<

Highlight selected item in “ListFragment”?

被刻印的时光 ゝ 提交于 2019-11-29 02:06:27
I have posted the same problem a couple of times but it hasn't yet been resolved. I have a ListFragment and I want to highlight the selected item in the list. I have been given suggestions to use a "selector". I don't understand how to use this selector. My ListFragment class is: // Create an adapter with list of stores and populate the list with // values ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, StoreList); setListAdapter(adapter); mDbHelper.close(); } /* * (non-Javadoc) * * Handles the event when an item is clicked on left

Onclicklistner not working in fragment listview

假装没事ソ 提交于 2019-11-28 12:28:07
I have a listview with custom adapter in listfragment and also set onclicklistner for listview. But Onclicklistner does not work. Here is my code: public class BasicFragment extends ListFragment { ListView lv; MyCustomAdapter adapter; @Override public void onCreate(Bundle si) { super.onCreate(si); } @Override public void onActivityCreated(Bundle b) { super.onActivityCreated(b); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_basic, container, false); lv = (ListView) view.findViewById

Communication between Fragments

家住魔仙堡 提交于 2019-11-28 11:40:01
I have default Master-Detail flow, which was created automatically when creating new project. My question is. When I add a button to detail side. Is there a way to update my list side by pressing that button ? In other words, can ItemDetailFragment and ItemListFragment communicate ? Yes just communicate through the activity with a listener. Your activity: public class MyActivity extends FragmentActivity implements OnFragmentClickListener { @Override public void OnFragmentClick(int action, Object object) { switch(action) { } } } The listener class: public interface OnFragmentClickListener {