List of usage examples for android.widget ListView setAdapter
@Override public void setAdapter(ListAdapter adapter)
From source file:com.cnpaypal.ObservableScrollView.BaseActivity.java
protected void setDummyData(ListView listView, int num) { listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, getDummyData(num))); }
From source file:com.example.android.tourguide.ShoppingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_shopping, container, false); // Construct the data source ArrayList<Location> arrayOfLocations = new ArrayList<Location>(); // Create the adapter to convert the array to views LocationAdapter adapter = new LocationAdapter(getActivity(), arrayOfLocations); // Attach the adapter to a ListView ListView listView = (ListView) v.findViewById(R.id.shoppingListView); listView.setAdapter(adapter); Location newLocation1 = new Location(getActivity().getString(R.string.marketMallName), getActivity().getString(R.string.marketMallAddress)); Location newLocation2 = new Location(getActivity().getString(R.string.marlMallName), getActivity().getString(R.string.marlMallAddress)); Location newLocation3 = new Location(getActivity().getString(R.string.southCentreMallName), getActivity().getString(R.string.southCentreMallAddress)); Location newLocation4 = new Location(getActivity().getString(R.string.chinookName), getActivity().getString(R.string.chinookAddress)); adapter.add(newLocation1);/*from www . j a v a 2 s.com*/ adapter.add(newLocation2); adapter.add(newLocation3); adapter.add(newLocation4); return v; }
From source file:com.example.picassodemo.SampleContactsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sample_contacts_activity); adapter = new SampleContactsAdapter(this); ListView lv = (ListView) findViewById(android.R.id.list); lv.setAdapter(adapter); getSupportLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, this); }
From source file:com.devergence.example.fraglistview.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Inicializamos los objetos de ejemplo List<CommentItem> comments = new LinkedList<CommentItem>(); comments.add(new CommentItem("Francisco", "comentario 1")); comments.add(new CommentItem("Alex", "comentario 2")); comments.add(new CommentItem("Miguel", "comentario 3")); comments.add(new CommentItem("Raquel", "comentario 4")); comments.add(new CommentItem("Chema", "comentario 5")); comments.add(new CommentItem("Alberto", "comentario 6")); comments.add(new CommentItem("Francisco", "comentario 7")); comments.add(new CommentItem("Maria", "comentario 8")); FeaturedItem featuredItem = new FeaturedItem("Manuel", "Este es el cuerpo del mensaje del elemento destacado."); //Preparamos el adaptador FeaturedAdapter commentsAdapter = new FeaturedAdapter(this, R.layout.item_left, featuredItem, comments); //Aplicamos el adaptador ListView lista = (ListView) findViewById(R.id.listView); lista.setAdapter(commentsAdapter); }
From source file:cnc.cad.mypicassso.SampleContactsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sample_contacts_activity); adapter = new SampleContactsAdapter(this); ListView lv = (ListView) findViewById(android.R.id.list); lv.setAdapter(adapter); lv.setOnScrollListener(new SampleScrollListener(this)); getSupportLoaderManager().initLoader(ContactsQuery.QUERY_ID, null, this); }
From source file:com.deveo.android.ProjectTeamFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_project_team, container, false); if (rootView != null) { ListView listView = (ListView) rootView.findViewById(R.id.list_view_events_project_team); listView.setAdapter(adapter); }/*from ww w.j a va 2s . c om*/ return rootView; }
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 ww w. ja v a 2 s . c o m*/ 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.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:com.deveo.android.ProjectSCMFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_project_scm, container, false); if (rootView != null) { ListView listView = (ListView) rootView.findViewById(R.id.list_view_events_project_scm); listView.setAdapter(adapter); }//from ww w . j ava 2 s.c o m return rootView; }
From source file:com.eyekabob.VenueList.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.adlistactivity); adapter = new VenueListAdapter(getApplicationContext()); Uri uri = this.getIntent().getData(); new RequestTask().execute(uri.toString()); ListView lv = (ListView) findViewById(R.id.adList); lv.setAdapter(adapter); lv.setOnItemClickListener(listItemListener); }