當前位置: 首頁>>代碼示例>>Java>>正文


Java ListFragment類代碼示例

本文整理匯總了Java中android.app.ListFragment的典型用法代碼示例。如果您正苦於以下問題:Java ListFragment類的具體用法?Java ListFragment怎麽用?Java ListFragment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ListFragment類屬於android.app包,在下文中一共展示了ListFragment類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: filter

import android.app.ListFragment; //導入依賴的package包/類
@Override
public void filter() {
	ArrayList<Location> filteredList = new ArrayList<Location>();
	for(Location loc : getLocationsList()) {
		boolean visible = 
				(!filterAllAges  || loc.isAll_ages()) // either we're not filtering or the location is all ages (if we are filtering)
				;
		if (visible) {
			filteredList.add(loc);
		}
	}
	ListFragment fragment = ((ListFragment) getFragmentManager().findFragmentByTag(LIST_TAG));
	@SuppressWarnings("unchecked")
	ArrayAdapter<Location> adapter = (ArrayAdapter<Location>) fragment.getListAdapter();
	adapter.clear();
	adapter.addAll(filteredList);
	sort();
}
 
開發者ID:aocole,項目名稱:skill-shot-android,代碼行數:19,代碼來源:LocationListActivity.java

示例2: sort

import android.app.ListFragment; //導入依賴的package包/類
private void sort() {
	ListFragment fragment = ((ListFragment) getFragmentManager().findFragmentByTag(LIST_TAG));
	@SuppressWarnings("unchecked")
	ArrayAdapter<Location> adapter = (ArrayAdapter<Location>) fragment.getListAdapter();
	Comparator<Location> comparator = new AlphaSort();
	if (filterSort == R.string.distance) {
		if (getUserLocation() == null) {
			Toast.makeText(this, R.string.location_unavailable, Toast.LENGTH_SHORT).show();
			return;
		}
		comparator = new DistanceSort();
	} else if (filterSort == R.string.number_of_games) {
		comparator = new NumGamesSort();
	}
	 
	adapter.sort(comparator);
	adapter.notifyDataSetChanged();
}
 
開發者ID:aocole,項目名稱:skill-shot-android,代碼行數:19,代碼來源:LocationListActivity.java

示例3: onCreate

import android.app.ListFragment; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_main4);

    View detailsFrame = findViewById(R.id.details);
    mDualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;

    if (savedInstanceState != null) {
        mCurCheckPosition = savedInstanceState.getInt("index", 0);
    }

    if(mDualPane){
        headlinesFragment = (ListFragment)getFragmentManager().findFragmentById(R.id.titles);
        headlinesFragment.getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        //onArticleSelected(mCurCheckPosition);
        headlinesFragment.getListView().setItemChecked(mCurCheckPosition,true);
        getFragmentManager().beginTransaction().add(R.id.details,
                ArticleFragment.newInstance(mCurCheckPosition)).commit();
    }
}
 
開發者ID:mylove2693,項目名稱:AndroidStudio-git-repo,代碼行數:22,代碼來源:FragmentDemoActivity.java

示例4: onFragmentViewCreated

import android.app.ListFragment; //導入依賴的package包/類
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    if (dayIndex < 0) {
        fragment.setListAdapter(mDayZeroAdapter);
        fragment.getListView().setRecyclerListener(mDayZeroAdapter);
    } else {
        fragment.setListAdapter(mScheduleAdapters[dayIndex]);
        fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:14,代碼來源:MyScheduleActivity.java

示例5: type

import android.app.ListFragment; //導入依賴的package包/類
public static SubjectFactory<ListFragmentSubject, ListFragment> type() {
  return new SubjectFactory<ListFragmentSubject, ListFragment>() {
    @Override
    public ListFragmentSubject getSubject(FailureStrategy fs, ListFragment that) {
      return new ListFragmentSubject(fs, that);
    }
  };
}
 
開發者ID:pkware,項目名稱:truth-android,代碼行數:9,代碼來源:ListFragmentSubject.java

示例6: replaceFragment

import android.app.ListFragment; //導入依賴的package包/類
public void replaceFragment(int layout, Fragment fragment) {
    if(fragment instanceof ListFragment){
        try{
            //fix some visual problems
            View vg = dashboardActivity.findViewById(layout);
            vg.invalidate();
        }catch (Exception e){}
    }

    FragmentTransaction ft = getFragmentTransaction();
    ft.replace(layout, fragment);
    ft.commit();
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:14,代碼來源:ModuleController.java

示例7: getPrimaryFragmentClass

import android.app.ListFragment; //導入依賴的package包/類
@NonNull
@SuppressWarnings("unchecked")
protected Class<? extends Fragment> getPrimaryFragmentClass() {
    Class<? extends Fragment> fragmentClass = (Class<? extends Fragment>) getIntent().getSerializableExtra(ARG_FRAGMENT_CLASS);
    if (fragmentClass == null) {
        fragmentClass = ListFragment.class;
    }
    return fragmentClass;
}
 
開發者ID:fuzz-productions,項目名稱:CutoutViewIndicator,代碼行數:10,代碼來源:PlainActivity.java

示例8: replaceFragment

import android.app.ListFragment; //導入依賴的package包/類
public void replaceFragment(int layout, Fragment fragment) {
    if (fragment instanceof ListFragment) {
        try {
            //fix some visual problems
            View vg = dashboardActivity.findViewById(layout);
            vg.invalidate();
        } catch (Exception e) {
        }
    }

    FragmentTransaction ft = getFragmentTransaction();
    ft.replace(layout, fragment);
    ft.commit();
}
 
開發者ID:EyeSeeTea,項目名稱:malariapp,代碼行數:15,代碼來源:ModuleController.java

示例9: setFragmentTransaction

import android.app.ListFragment; //導入依賴的package包/類
/**
 * Init the fragments
 */
private void setFragmentTransaction(int layout, ListFragment fragment) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.add(layout, fragment);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.commit();
}
 
開發者ID:EyeSeeTea,項目名稱:pictureapp,代碼行數:10,代碼來源:DashboardActivity.java

示例10: onFragmentViewCreated

import android.app.ListFragment; //導入依賴的package包/類
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(com.saarang.samples.apps.iosched.R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    fragment.setListAdapter(mScheduleAdapters[dayIndex]);
    fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
 
開發者ID:The-WebOps-Club,項目名稱:saarang-iosched,代碼行數:9,代碼來源:MyScheduleActivity.java

示例11: onFragmentViewCreated

import android.app.ListFragment; //導入依賴的package包/類
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    fragment.setListAdapter(mScheduleAdapters[dayIndex]);
    fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
 
開發者ID:gdg-bh,項目名稱:AppDevFestSudeste2015,代碼行數:9,代碼來源:MyScheduleActivity.java

示例12: newInstance

import android.app.ListFragment; //導入依賴的package包/類
public static ListFragment newInstance(String param1, String param2) {
    ListFragment fragment = new ListFragment();
    Bundle args = new Bundle();
    args.putString(ARG_PARAM1, param1);
    args.putString(ARG_PARAM2, param2);
    fragment.setArguments(args);
    return fragment;
}
 
開發者ID:tschuy,項目名稱:FishApp,代碼行數:9,代碼來源:ProductVendorListFragment.java

示例13: getFavouritesAdapter

import android.app.ListFragment; //導入依賴的package包/類
static
AdapterFeedItems getFavouritesAdapter(Activity activity)
{
    FragmentManager manager = activity.getFragmentManager();
    ListFragment fragment = (ListFragment) manager.findFragmentById(R.id.fragment_favourites);
    return (AdapterFeedItems) fragment.getListAdapter();
}
 
開發者ID:DarkangelKid,項目名稱:rss,代碼行數:8,代碼來源:ListFragmentTag.java

示例14: onCreate

import android.app.ListFragment; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rest_service);
    
    mAdapter = new ArrayAdapter<String>(this, R.layout.item_label_list);
    
    FragmentManager     fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    
    ListFragment list = new ListFragment();
    ft.add(R.id.fragment_content, list);
    
    // Let's set our list adapter to a simple ArrayAdapter.
    list.setListAdapter(mAdapter);
    
    // RESTResponderFragments call setRetainedInstance(true) in their onCreate() method. So that means
    // we need to check if our FragmentManager is already storing an instance of the responder.
    TwitterSearchResponderFragment responder = 
            (TwitterSearchResponderFragment) fm.findFragmentByTag("RESTResponder");
    if (responder == null) {
        responder = new TwitterSearchResponderFragment();
        
        // We add the fragment using a Tag since it has no views. It will make the Twitter REST call
        // for us each time this Activity is created.
        ft.add(responder, "RESTResponder");
    }

    // Make sure you commit the FragmentTransaction or your fragments
    // won't get added to your FragmentManager. Forgetting to call ft.commit()
    // is a really common mistake when starting out with Fragments.
    ft.commit();
}
 
開發者ID:mobilepaas,項目名稱:gasp-android,代碼行數:34,代碼來源:TwitterRESTServiceActivity.java

示例15: onCreate

import android.app.ListFragment; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rest_service);
    
    mAdapter = new ArrayAdapter<String>(this, R.layout.item_label_list);
    
    FragmentManager     fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    
    ListFragment list = new ListFragment();
    ft.add(R.id.fragment_content, list);
    
    list.setListAdapter(mAdapter);
    
    // RESTResponderFragments call setRetainedInstance(true) in their onCreate() method. So that means
    // we need to check if our FragmentManager is already storing an instance of the responder.
    GaspReviewsResponderFragment responder = 
            (GaspReviewsResponderFragment) fm.findFragmentByTag("RESTResponder");
    if (responder == null) {
        responder = new GaspReviewsResponderFragment();
        
        // We add the fragment using a Tag since it has no views. It will make the Twitter REST call
        // for us each time this Activity is created.
        ft.add(responder, "RESTResponder");
    }

    ft.commit();
}
 
開發者ID:mobilepaas,項目名稱:gasp-android,代碼行數:30,代碼來源:GaspRESTServiceActivity.java


注:本文中的android.app.ListFragment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。