List of usage examples for android.widget ListAdapter getItem
Object getItem(int position);
From source file:com.nadmm.airports.tfr.TfrListFragment.java
@Override protected void onListItemClick(ListView l, View v, int position) { ListAdapter adapter = getListView().getAdapter(); Tfr tfr = (Tfr) adapter.getItem(position); if (tfr != null) { Intent activity = new Intent(getActivity(), TfrDetailActivity.class); activity.putExtra(TfrListActivity.EXTRA_TFR, tfr); startActivity(activity);/*from w w w . jav a 2 s . c o m*/ } }
From source file:org.emergent.android.weave.PasswordListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { Activity activity = getActivity();//from w w w .ja v a 2 s. co m if (activity == null) { Log.w(TAG, "onListItemClick: Activity was null!"); return; } ListAdapter listAdapter = getListAdapter(); Cursor cursor = (Cursor) listAdapter.getItem(position); String pword = cursor.getString(cursor.getColumnIndex(Passwords.Columns.PASSWORD)); ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(pword); String msg = "Password copied to clipboard."; Toast toast = Toast.makeText(activity, msg, Toast.LENGTH_SHORT); toast.show(); }
From source file:org.emergent.android.weave.MiscListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { Activity activity = getActivity();//www .ja v a 2s . co m if (activity != null) { ListAdapter listAdapter = getListAdapter(); LocationModel locationModel = (LocationModel) listAdapter.getItem(position); MainActivity frontActivity = (MainActivity) activity; frontActivity.setMyFragment(locationModel.getFragment(frontActivity)); } }
From source file:org.emergent.android.weave.BookmarkListFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { Activity activity = getActivity();//from ww w . j a va 2 s .c o m if (activity == null) { Log.w(TAG, "onListItemClick: Activity was null!"); return; } ListAdapter listAdapter = getListAdapter(); Cursor cursor = (Cursor) listAdapter.getItem(position); String type = cursor.getString(cursor.getColumnIndex(Bookmarks.Columns.TYPE)); if ("folder".equals(type)) { String uuid = cursor.getString(cursor.getColumnIndex(Bookmarks.Columns.UUID)); String title = cursor.getString(cursor.getColumnIndex(Bookmarks.Columns.TITLE)); Log.d(TAG, String.format("BookmarkListFragment.onListItemClick: %s \"%s\" %s", type, title, uuid)); moveIntoFolder(uuid, title); } else { String uri = cursor.getString(cursor.getColumnIndex(Bookmarks.Columns.BMK_URI)); Log.d(TAG, String.format("BookmarkListFragment.onListItemClick: %s \"%s\"", type, uri)); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); } }
From source file:can.yrt.onebusaway.MySearchRoutesFragment.java
private String getId(ListView l, int position) { ListAdapter adapter = l.getAdapter(); ObaRoute route = (ObaRoute) adapter.getItem(position - l.getHeaderViewsCount()); return route.getId(); }
From source file:can.yrt.onebusaway.MySearchRoutesFragment.java
private String getUrl(ListView l, int position) { ListAdapter adapter = l.getAdapter(); ObaRoute route = (ObaRoute) adapter.getItem(position - l.getHeaderViewsCount()); return route.getUrl(); }
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 .j ava 2s .c o m*/ RouteInfoActivity.start(getActivity(), routeId); } }
From source file:org.onebusaway.android.ui.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 = UIUtils.getRouteDisplayName(route); if (isShortcutMode()) { Intent intent = RouteInfoActivity.makeIntent(getActivity(), routeId); makeShortcut(routeName, intent); } else {//from w w w. ja v a2 s.co m RouteInfoActivity.start(getActivity(), routeId); } }
From source file:org.mariotaku.twidere.fragment.UserListsListFragment.java
@Override public boolean onItemLongClick(final AdapterView<?> parent, final View view, final int position, final long id) { if (mApplication.isMultiSelectActive()) return true; mSelectedUserList = null;/*from w w w .j a v a2s .c om*/ final ListAdapter adapter = getListAdapter(); final Object selected = adapter.getItem(position - mListView.getHeaderViewsCount()); mSelectedUserList = selected instanceof ParcelableUserList ? (ParcelableUserList) selected : null; if (mSelectedUserList == null) return false; mPopupMenu = PopupMenu.getInstance(getActivity(), view); mPopupMenu.inflate(R.menu.action_user_list); final Menu menu = mPopupMenu.getMenu(); final MenuItem extensions = menu.findItem(MENU_EXTENSIONS_SUBMENU); if (extensions != null) { final Intent intent = new Intent(INTENT_ACTION_EXTENSION_OPEN_USER_LIST); final Bundle extras = new Bundle(); extras.putParcelable(INTENT_KEY_USER_LIST, mSelectedUserList); intent.putExtras(extras); addIntentToSubMenu(getActivity(), extensions.getSubMenu(), intent); } mPopupMenu.setOnMenuItemClickListener(this); mPopupMenu.show(); return true; }
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);/*from w w w.j ava 2 s .c o m*/ } else if (e instanceof ObaStop) { clickStop((ObaStop) e); } }