Example usage for android.widget ListView getAdapter

List of usage examples for android.widget ListView getAdapter

Introduction

In this page you can find the example usage for android.widget ListView getAdapter.

Prototype

@Override
public ListAdapter getAdapter() 

Source Link

Document

Returns the adapter currently in use in this ListView.

Usage

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:python.filechooser.FileListFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    FileListAdapter adapter = (FileListAdapter) l.getAdapter();
    if (adapter != null) {
        File file = (File) adapter.getItem(position);
        mPath = file.getAbsolutePath();//from ww  w  .j  a  v  a  2 s. c om
        mListener.onFileSelected(file, false);
    }
}

From source file:can.yrt.onebusaway.MySearchStopsFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    ObaStop stop = (ObaStop) l.getAdapter().getItem(position - l.getHeaderViewsCount());
    final String shortcutName = stop.getName();

    ArrivalsListActivity.Builder b = new ArrivalsListActivity.Builder(getActivity(), stop);
    if (isShortcutMode()) {
        makeShortcut(shortcutName, b.getIntent());
    } else {//from ww  w  .  j ava  2 s  .c o m
        b.setUpMode(NavHelp.UP_MODE_BACK);
        b.start();
    }
}

From source file:can.yrt.onebusaway.MyStopListFragmentBase.java

protected StopData getStopData(ListView l, int position) {
    // Get the cursor and fetch the stop ID from that.
    SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter();
    return new StopData(cursorAdapter.getCursor(), position - l.getHeaderViewsCount());
}

From source file:net.illusor.swipeplayer.activities.SwipeActivityTest.java

@SmallTest
public void testInitialBrowserState() throws Exception {
    View folderBrowserView = this.viewPager.getChildAt(1);

    DropDown dropDown = (DropDown) folderBrowserView.findViewById(R.id.id_fb_nav_history);
    assertNotNull("FolderBrowser dropdown is null", dropDown);

    SpinnerAdapter spinnerAdapter = dropDown.getAdapter();
    assertNotNull("FolderBrowser dropdown adapter is null", spinnerAdapter);
    assertEquals("FolderBrowser dropdown adapter should initially contain 1 item", 1,
            spinnerAdapter.getCount());/*from  w  w w.java 2s . c o  m*/

    ListView listView = (ListView) folderBrowserView.findViewById(R.id.id_fb_audio_files);
    assertNotNull("FolderBrowser list is null", listView);

    ListAdapter listAdapter = listView.getAdapter();
    assertNotNull("FolderBrowser list adapter is null", listAdapter);
    assertEquals("FolderBrowser list adapter should initially contain 1 item", 1, listAdapter.getCount());
}

From source file:org.onebusaway.android.ui.MySearchStopsFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    ObaStop stop = (ObaStop) l.getAdapter().getItem(position - l.getHeaderViewsCount());
    final String shortcutName = stop.getName();

    // TODO - Pass in a route mapping?  Can we get away with just a stopId here?
    ArrivalsListActivity.Builder b = new ArrivalsListActivity.Builder(getActivity(), stop.getId());
    if (isShortcutMode()) {
        makeShortcut(shortcutName, b.getIntent());
    } else {/*  w w  w. j  a v a  2s.  c  o m*/
        b.setUpMode(NavHelp.UP_MODE_BACK);
        b.start();
    }
}

From source file:can.yrt.onebusaway.MyStopListFragmentBase.java

private void showOnMap(ListView l, int position) {
    // Get the cursor and fetch the stop ID from that.
    SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter();
    Cursor c = cursorAdapter.getCursor();
    c.moveToPosition(position - l.getHeaderViewsCount());
    final String stopId = c.getString(COL_ID);
    final double lat = c.getDouble(COL_LATITUDE);
    final double lon = c.getDouble(COL_LONGITUDE);

    HomeActivity.start(getActivity(), stopId, lat, lon);
}

From source file:com.filepager.afilechooser.FileListFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    FileListAdapter adapter = (FileListAdapter) l.getAdapter();
    if (adapter != null) {
        File file = (File) adapter.getItem(position);
        FilesHolder fh = adapter.getFH();
        mPath = file.getAbsolutePath();/*  w  ww. java2s .  c o  m*/
        ((FileChooserActivity) getActivity()).onFileSelected(file, fh);

    }
}

From source file:au.org.ala.fielddata.mobile.ui.SpeciesListFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    Activity activity = getSherlockActivity();
    if (activity instanceof SpeciesSelectionListener) {
        Species species = (Species) l.getAdapter().getItem(position);
        ((SpeciesSelectionListener) activity).onSpeciesSelected(species);
    }/*  w w  w .ja  va 2  s  .c  om*/
}