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:com.zawadz88.realestate.test.MainActivityTest.java

@SmallTest
public void testNavigationDrawerListNotEmpty() {
    ListView listView = (ListView) solo.getView(com.zawadz88.realestate.R.id.navigation_list);
    assertNotNull(listView);/*from w  ww. ja va 2s.  c  o  m*/
    assertNotNull(listView.getAdapter());
    assertFalse(listView.getAdapter().isEmpty());
}

From source file:de.hska.iam.presentationapp.fragments.FolderListFragment.java

@Override
public void onListItemClick(final ListView listView, final View view, final int position, final long id) {
    String folderName = (String) listView.getAdapter().getItem(position);
    folderHierarchy.cd(folderName);//  w  w w. ja  v  a 2  s  . c o  m
    folderChanged();
}

From source file:org.arakhne.afc.ui.android.filechooser.FileListFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    FileListAdapter adapter = (FileListAdapter) l.getAdapter();
    if (adapter != null) {
        this.path = adapter.getItem(position);
        Activity activity = getActivity();
        if (activity instanceof FileChooserActivity) {
            ((FileChooserActivity) getActivity()).onSelectedFile(this.path);
        }//from   w ww.ja  v  a 2  s  .  c  o  m

    }
}

From source file:li.klass.fhem.appwidget.view.widget.base.otherWidgets.OtherWidgetsFragment.java

@Override
public void update(boolean doUpdate) {
    checkNotNull(widgetSize);//from ww  w. j  av  a2 s. c om

    if (getView() == null)
        return;

    ListView listView = (ListView) getView().findViewById(R.id.list);
    OtherWidgetsAdapter adapter = (OtherWidgetsAdapter) listView.getAdapter();

    final List<WidgetType> widgets = WidgetType.getOtherWidgetsFor(widgetSize);
    List<Pair<WidgetType, String>> values = newArrayList(
            transform(widgets, new Function<WidgetType, Pair<WidgetType, String>>() {
                @Override
                public Pair<WidgetType, String> apply(WidgetType widgetType) {
                    return Pair.of(widgetType, getActivity().getString(widgetType.widgetView.getWidgetName()));
                }
            }));

    if (values.isEmpty()) {
        showEmptyView();
    } else {
        hideEmptyView();
    }

    adapter.updateData(values);
}

From source file:ca.ualberta.cmput301w14t08.geochan.test.ThreadViewFragmentTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();
    this.activity = getActivity();
    Comment testComment = new Comment("hello", null, null);
    //testComment.addChild(new Comment("test", null));
    ThreadList.addThread(testComment, "test thread");
    //Click the thread to open the fragment
    activity.runOnUiThread(new Runnable() {
        @Override/*  w w  w  .  j a v a 2 s  .c o  m*/
        public void run() {
            ListView listView = (ListView) activity
                    .findViewById(ca.ualberta.cmput301w14t08.geochan.R.id.thread_list);
            listView.performItemClick(listView.getAdapter().getView(0, null, null), 0, 0);
        }
    });
    ThreadViewFragment fragment = (ThreadViewFragment) waitForFragment("thread_view_fragment", 5000);
    assertNotNull("fragment not initialized", fragment);
}

From source file:org.wheelmap.android.fragment.FilterWheelchairStateFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    MergeAdapter adapter = (MergeAdapter) l.getAdapter();
    Object item = l.getItemAtPosition(position);
    if (item instanceof WheelchairAttributes) {
        clickWheelStateItem((WheelchairAttributes) item, adapter);
    }/*  w ww  .  j  a v  a  2 s . co m*/
}

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

private void showOnMap(ListView l, int position) {
    ObaStop stop = (ObaStop) l.getAdapter().getItem(position - l.getHeaderViewsCount());
    final String stopId = stop.getId();
    final double lat = stop.getLatitude();
    final double lon = stop.getLongitude();

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

From source file:org.wheelmap.android.fragment.FilterCategoriesFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    MergeAdapter adapter = (MergeAdapter) l.getAdapter();
    Object item = l.getItemAtPosition(position);
    if (item instanceof Cursor) {
        clickCategorieItem((Cursor) item);
    }/*  www  .ja va2s .  co  m*/
}

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

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

    // 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 routeId = c.getString(COL_ID);
    final String routeName = c.getString(COL_SHORTNAME);

    if (isShortcutMode()) {
        final Intent shortcut = UIHelp.makeShortcut(getActivity(), routeName,
                RouteInfoActivity.makeIntent(getActivity(), routeId));

        Activity activity = getActivity();
        activity.setResult(Activity.RESULT_OK, shortcut);
        activity.finish();//from   ww  w. j a  v  a  2  s  .  co m

    } else {
        RouteInfoActivity.start(getActivity(), routeId);
    }
}

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

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

    // Get the cursor and fetch the route ID from that.
    SimpleCursorAdapter cursorAdapter = (SimpleCursorAdapter) l.getAdapter();
    Cursor c = cursorAdapter.getCursor();
    c.moveToPosition(position - l.getHeaderViewsCount());
    final String routeId = c.getString(COL_ID);
    final String routeName = c.getString(COL_SHORTNAME);

    if (isShortcutMode()) {
        final Intent shortcut = UIUtils.makeShortcut(getActivity(), routeName,
                RouteInfoActivity.makeIntent(getActivity(), routeId));

        Activity activity = getActivity();
        activity.setResult(Activity.RESULT_OK, shortcut);
        activity.finish();/*from  w  w  w.j a v a 2  s .  c  o m*/

    } else {
        RouteInfoActivity.start(getActivity(), routeId);
    }
}