List of usage examples for android.widget ListView ListView
public ListView(Context context)
From source file:org.danbrough.mega.ui.FilesFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { log.info("onCreateView()"); fileView = new ListView(getActivity()); registerForContextMenu(fileView);/*w w w .j av a 2 s.c om*/ filesAdapter = new FilesAdapter(getActivity()); fileView.setAdapter(filesAdapter); filesAdapter.setNotifyOnChange(false); fileView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { log.info("itemClicked: {}", filesAdapter.getItem(position)); onNodeClicked(view, filesAdapter.getItem(position)); } }); fileView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { onNodeLongClicked(view, filesAdapter.getItem(position)); return true; } }); refresh(); return fileView; }
From source file:com.farmerbb.taskbar.fragment.SelectAppFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { SelectAppActivity activity = (SelectAppActivity) getActivity(); ListView appList = new ListView(activity); int type = getArguments().getInt(ARG_SECTION_NUMBER); appList.setAdapter(activity.getAppListAdapter(type)); return appList; }
From source file:org.deviceconnect.android.manager.setting.OpenSourceLicenseFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { mLogger.entering(getClass().getName(), "onCreateView", new Object[] { inflater, container, savedInstanceState }); FrameLayout lframe = new FrameLayout(getActivity()); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list);/*from w w w . j av a 2 s. co m*/ lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); lframe.setBackgroundColor(getResources().getColor(android.R.color.background_light)); ArrayAdapter<Parcelable> adapter = new SoftwareArrayAdapter(getActivity(), R.layout.item_open_source_licenses); if (getArguments() != null && getArguments().containsKey(EXTRA_OSS)) { adapter.addAll(getArguments().getParcelableArrayList(EXTRA_OSS)); } ListView listView = (ListView) lframe.findViewById(android.R.id.list); listView.setAdapter(adapter); getDialog().setTitle(R.string.activity_settings_open_source_licenses); mLogger.exiting(getClass().getName(), "onCreateView", lframe); return lframe; }
From source file:org.bitbucket.ntakimura.android.support.fragment.OpenSourceLicenseFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { mLogger.entering(getClass().getName(), "onCreateView", new Object[] { inflater, container, savedInstanceState }); FrameLayout lframe = new FrameLayout(getActivity()); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list);/*w w w . j a va 2 s . c o m*/ lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); lframe.setBackgroundColor(getResources().getColor(android.R.color.background_light)); ArrayAdapter<Parcelable> adapter = new SoftwareArrayAdapter(getActivity(), R.layout.card_item); if (getArguments() != null && getArguments().containsKey(EXTRA_OSS)) { adapter.addAll(getArguments().getParcelableArrayList(EXTRA_OSS)); } ListView listView = (ListView) lframe.findViewById(android.R.id.list); listView.setAdapter(adapter); getDialog().setTitle(R.string.open_source_licenses); mLogger.exiting(getClass().getName(), "onCreateView", lframe); return lframe; }
From source file:com.boanda.tool.push.fragment.DisplayFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mListView = new ListView(getActivity()); mListView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); mAdapter = new ItemAdapter(); mListView.setAdapter(mAdapter);// w w w. j a v a 2s. c om return mListView; }
From source file:ie.tcd.scss.dsg.particpatory.SampleListFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Menu menu = newMenuInstance(getActivity()); if (menu != null) { new MenuInflater(getActivity()).inflate(R.menu.sliding_menu, menu); MenuListAdapter adapter = new MenuListAdapter(getActivity()); for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); adapter.add(new SampleItem(item.getTitle().toString(), item.getIcon())); }/*from w ww . j a v a 2 s.c o m*/ setListAdapter(adapter); } else { TextView emptyText = new TextView(getActivity()); emptyText.setText("No Menu"); getListView().setEmptyView(emptyText); } ListView listView = new ListView(getActivity()); listView.setId(android.R.id.list); return listView; }
From source file:pl.kalisz.kamil.SamplesMenuActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); listView = new ListView(this); setContentView(listView);//from w w w . ja va 2s . co m menuAdapter = buildMenuAdapter(); listView.setAdapter(menuAdapter); listView.setOnItemClickListener(menuAdapter); }
From source file:ch.jeda.platform.android.SelectionDialogFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final ListView result = new ListView(this.getActivity()); this.listAdapter = new ListAdapterImp(this.getActivity()); this.listAdapter.setItems(this.request.getDisplayItems()); result.setAdapter(this.listAdapter); result.setOnItemClickListener(new OnItemClickListenerImp(this)); this.selectedItemPosition = -1; return result; }
From source file:at.wada811.android.dialogfragments.sample.progressdialogfragment.examples.LoaderSpinnerProgressDialogFragmentExamplesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ArrayList<String> items = new ArrayList<String>(); items.add("Start Loader"); ListView listView = new ListView(this); listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items)); listView.setOnItemClickListener(this); setContentView(listView);//from w w w. j a v a 2 s .c om if (getSupportLoaderManager().getLoader(LOADER_ID) != null) { getSupportLoaderManager().initLoader(LOADER_ID, null, this); Log.i(LoaderSpinnerProgressDialogFragmentExamplesActivity.class.getSimpleName(), "re-init: " + LOADER_ID); } }
From source file:com.skubit.android.example.PurchasesFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { listView = new ListView(getActivity()); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from w w w . ja v a 2s .c o m*/ public void onItemClick(AdapterView<?> parent, View view, int position, long id) { } }); return listView; }