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


Java ListFragment.setListAdapter方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例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);
    fragment.setListAdapter(mScheduleAdapters[dayIndex]);
    fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
 
開發者ID:gdg-bh,項目名稱:AppDevFestSudeste2015,代碼行數:9,代碼來源:MyScheduleActivity.java

示例5: 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.setListAdapter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。