List of usage examples for android.widget ListView getAdapter
@Override
public ListAdapter getAdapter()
From source file:org.wheelmap.android.fragment.POIsListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); saveListPosition();// ww w. j a v a 2 s . c o m Cursor cursor = (Cursor) l.getAdapter().getItem(position); if (cursor == null) return; long poiId = POIHelper.getId(cursor); mListener.onWheelmapPOIClicked(poiId); }
From source file:at.alladin.rmbt.android.views.ResultQoSDetailView.java
@SuppressWarnings("unchecked") @Override/* w ww .j av a2 s .co m*/ public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { ListView listView = (ListView) adapter; HashMap<String, String> item = (HashMap<String, String>) listView.getAdapter().getItem(position); if (listView.getId() == R.id.qos_success_list) { activity.showExpandedResultDetail(results, DetailType.OK, Integer.valueOf(item.get("index"))); } else if (listView.getId() == R.id.qos_error_list) { activity.showExpandedResultDetail(results, DetailType.FAIL, Integer.valueOf(item.get("index"))); } }
From source file:th.in.ffc.person.PersonListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { HighLightCursorAdapter apt = (HighLightCursorAdapter) l.getAdapter(); String pcucodeperson = apt.getData(position, Person.PCUPERSONCODE); Intent intent = new Intent(Action.VIEW); intent.addCategory(Category.PERSON); PersonActivity.startPersonActivity(getActivity(), intent, "" + id, pcucodeperson); }
From source file:com.blogspot.marioboehmer.thingibrowse.fragments.ThingResultListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { ThingResultListItem thingResultListItem = (ThingResultListItem) l.getAdapter().getItem(position); onThingSelectedListener.onThingSelected(thingResultListItem.getThingUrl()); }
From source file:can.yrt.onebusaway.SearchResponse.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { ListAdapter adapter = l.getAdapter(); ObaElement e = (ObaElement) adapter.getItem(position - l.getHeaderViewsCount()); if (e instanceof ObaRoute) { clickRoute((ObaRoute) e);/*www. ja va2 s . c om*/ } else if (e instanceof ObaStop) { clickStop((ObaStop) e); } }
From source file:dev.drsoran.moloko.fragments.ChangeTagsFragment.java
private void onListItemClick(ListView l, View v, int position, long id) { final ChangeTag tag = (ChangeTag) l.getAdapter().getItem(position); final Editable tagsEdit = editView.getEditableText(); if (tag.isAvailable) { if (TextUtils.isEmpty(tagsEdit)) { tagsEdit.append(tag.tag);/*from w w w . ja va 2 s. com*/ } else { final int trimmedLength = TextUtils.getTrimmedLength(tagsEdit); if (tagsEdit.charAt(trimmedLength - 1) == ',') { tagsEdit.append(tag.tag); } else { tagsEdit.append(", " + tag.tag); } } } else { // Cut the removed tag including any trailing , String content = UIUtils.getTrimmedText(editView); content = content.replaceAll(tag.tag + "\\,*\\s*", Strings.EMPTY_STRING); editView.setText(content); } Selection.setSelection(tagsEdit, tagsEdit.length()); updateTagList(); }
From source file:org.deviceconnect.android.uiapp.fragment.PluginListFragment.java
@Override public void onListItemClick(final ListView parent, final View view, final int position, final long id) { DevicePlugin plugin = (DevicePlugin) parent.getAdapter().getItem(position); SystemWakeupLoader loader = new SystemWakeupLoader(); loader.execute(plugin.getId());/*w ww. j a v a 2 s . c om*/ }
From source file:com.bamalearn.bamalearnburmese.DrawerMainActivity.java
public void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { return;/*from w w w . j av a 2s .co m*/ } int totalHeight = listView.getPaddingTop() + listView.getPaddingBottom(); for (int i = 0; i < listAdapter.getCount(); i++) { View listItem = listAdapter.getView(i, null, listView); if (listItem instanceof ViewGroup) listItem.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.WRAP_CONTENT, AbsListView.LayoutParams.WRAP_CONTENT)); listItem.measure(0, 0); totalHeight += listItem.getMeasuredHeight(); } ViewGroup.LayoutParams params = listView.getLayoutParams(); params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); listView.setLayoutParams(params); }
From source file:com.example.arrayjumper.FragmentBasics.HeadlinesFragment.java
public View getViewByPosition(int pos, ListView listView) { final int firstListItemPosition = listView.getFirstVisiblePosition(); final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1; if (pos < firstListItemPosition || pos > lastListItemPosition) { return listView.getAdapter().getView(pos, null, listView); } else {//from w w w .j a v a 2 s. com final int childIndex = pos - firstListItemPosition; return listView.getChildAt(childIndex); } }
From source file:can.yrt.onebusaway.MySearchRoutesFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { // Get the adapter (this may or may not be a SimpleCursorAdapter) ListAdapter adapter = l.getAdapter(); ObaRoute route = (ObaRoute) adapter.getItem(position - l.getHeaderViewsCount()); final String routeId = route.getId(); final String routeName = UIHelp.getRouteDisplayName(route); if (isShortcutMode()) { Intent intent = RouteInfoActivity.makeIntent(getActivity(), routeId); makeShortcut(routeName, intent); } else {/*w w w . jav a 2s . c om*/ RouteInfoActivity.start(getActivity(), routeId); } }