本文整理了Java中android.app.ListFragment.onActivityCreated()
方法的一些代码示例,展示了ListFragment.onActivityCreated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListFragment.onActivityCreated()
方法的具体详情如下:
包路径:android.app.ListFragment
类名称:ListFragment
方法名:onActivityCreated
暂无
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,
items));
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onActivityCreated(Bundle state) {
super.onActivityCreated(state);
setRetainInstance(true);
getListView().setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
if (adapter == null) {
adapter=new EventLogAdapter();
}
setListAdapter(adapter);
}
代码示例来源:origin: jaredrummler/AndroidProcesses
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
getListView().setFastScrollEnabled(true);
new AndroidAppProcessLoader(getActivity(), this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
代码示例来源:origin: trishika/DroidUPnP
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
list = new ArrayAdapter<>(this.getView().getContext(), R.layout.device_list_item);
setListAdapter(list);
Log.d(TAG, "Activity created");
}
代码示例来源:origin: li2/learning-android-open-source
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, Shakespeare.TITLES));
}
代码示例来源:origin: qiubiteme/android_api_demos
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ArrayAdapter<>(getActivity(),
android.R.layout.simple_list_item_1, Shakespeare.TITLES));
}
代码示例来源:origin: hiteshbpatel/Android_Blog_Projects
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
this.setListAdapter(new WiFiPeerListAdapter(getActivity(), R.layout.row_devices, peers));
}
代码示例来源:origin: leafye/AndroidBlogSource
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
//绑定数据列表
setListAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, android.R.id.text1, articleTitles));
View details = getActivity().findViewById(R.id.details_container);
//检测是否使用大屏幕尺寸的布局
isScreenPad = details != null && details.getVisibility() == View.VISIBLE;
if(savedInstanceState != null){
//获取上次离开界面时列表选项值
mCurrentPosition = savedInstanceState.getInt("currentChoice", 0);
}
if(isScreenPad){
//设置列表选中的选项高亮
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
showDetails(mCurrentPosition);
}
}
代码示例来源:origin: sylvek/itracing2
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
mAdapter = new EventsCursorAdapter(getActivity());
setListAdapter(mAdapter);
getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l)
{
final TextView textView = (TextView) view.findViewById(android.R.id.text1);
final String option = (String) textView.getTag();
if (CapturePosition.NAME.equals(textView.getText())) {
startActivity(CapturePosition.getMapIntent(option));
} else {
Toast.makeText(getActivity(), option, Toast.LENGTH_LONG).show();
}
}
});
}
代码示例来源:origin: jclehner/rxdroid
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
mAdapter = onCreateAdapter();
setListAdapter(mAdapter);
setListShown(false);
getLoaderManager().initLoader(0, null, this);
}
代码示例来源:origin: geniusgithub/AndroidDialer
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (mAdapter == null) {
mAdapter = ViewNumbersToImportAdapter.newViewNumbersToImportAdapter(
getContext(), getActivity().getFragmentManager());
}
setListAdapter(mAdapter);
}
代码示例来源:origin: andforce/iBeebo
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
name = new ArrayList<String>();
adapter = new GroupAdapter();
getListView().setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
getListView().setMultiChoiceModeListener(new GroupMultiChoiceModeListener());
setListAdapter(adapter);
group = BeeboApplication.getInstance().getGroup();
if (group != null) {
final List<GroupBean> list = group.getLists();
for (int i = 0; i < list.size(); i++) {
name.add(list.get(i).getName());
}
adapter.notifyDataSetChanged();
}
}
代码示例来源:origin: openbmap/radiocells-scanner-android
/**
* @link http://stackoverflow.com/questions/6317767/cant-add-a-headerview-to-a-listfragment
* Fragment lifecycle
* onAttach(Activity) called once the fragment is associated with its activity.
* onCreate(Bundle) called to do initial creation of the fragment.
* onCreateView(LayoutInflater, ViewGroup, Bundle) creates and returns the view hierarchy associated with the fragment.
* onActivityCreated(Bundle) tells the fragment that its activity has completed its own Activity.onCreate.
* onStart() makes the fragment visible to the user (based on its containing activity being started).
* onResume() makes the fragment interacting with the user (based on its containing activity being resumed).
*/
@Override
public final void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
this.getListView().addHeaderView(mHeader);
// setup data
initData();
getActivity().getLoaderManager().initLoader(CELL_LOADER_ID, null, this);
}
代码示例来源:origin: openbmap/radiocells-scanner-android
@Override
public final void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
this.getListView().addHeaderView(mHheader);
registerForContextMenu(mHheader);
initUi();
// setup data
initData();
getActivity().getLoaderManager().initLoader(WIFI_LOADER_ID, null, this);
}
代码示例来源:origin: li2/learning-android-open-source
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No applications");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new AppListAdapter(getActivity());
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
代码示例来源:origin: li2/learning-android-open-source
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setEmptyText("No data. Select 'Populate' to fill with data from Z to A at a rate of 4 per second.");
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),
android.R.layout.simple_list_item_1, null,
new String[] { MainTable.COLUMN_NAME_DATA },
new int[] { android.R.id.text1 }, 0);
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
代码示例来源:origin: qiubiteme/android_api_demos
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setEmptyText("没有数据。选择“填充”从ž数据填充到A以每秒4次的速度。");
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),
android.R.layout.simple_list_item_1, null,
new String[] { MainTable.COLUMN_NAME_DATA },
new int[] { android.R.id.text1 }, 0);
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
代码示例来源:origin: qiubiteme/android_api_demos
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No applications");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new AppListAdapter(getActivity());
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
代码示例来源:origin: li2/learning-android-open-source
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),
android.R.layout.simple_list_item_2, null,
new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
new int[] { android.R.id.text1, android.R.id.text2 }, 0);
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
代码示例来源:origin: qiubiteme/android_api_demos
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),
android.R.layout.simple_list_item_2, null,
new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
new int[] { android.R.id.text1, android.R.id.text2 }, 0);
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
内容来源于网络,如有侵权,请联系作者删除!