Java Code Examples for android.widget.AbsListView#setOnItemClickListener()

The following examples show how to use android.widget.AbsListView#setOnItemClickListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LiveTVFragment.java    From video-player with MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_livetv, container, false);

    progressBar = (ProgressBar) view.findViewById(R.id.livetv_progress_bar);

    progressBar.setVisibility(ProgressBar.VISIBLE);
    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    ((AdapterView<ListAdapter>) mListView).setAdapter(adapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example 2
Source File: ScanActivity.java    From BlueSTSDK_Android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scan);

    AbsListView listView = (AbsListView) findViewById(R.id.nodeListView);
    //create the adapter and set it to the list view
    mAdapter = new NodeArrayAdapter(this);
    listView.setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    listView.setOnItemClickListener(this);

    //add the already discovered nodes
    mAdapter.addAll(mManager.getNodes());

}
 
Example 3
Source File: SearchList.java    From moviedb-android with Apache License 2.0 6 votes vote down vote up
/**
 * Called to have the fragment instantiate its user interface view.
 *
 * @param inflater           sets the layout for the current view.
 * @param container          the container which holds the current view.
 * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
 *                           Return the View for the fragment's UI, or null.
 */
@SuppressLint("ShowToast")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);


    View rootView = inflater.inflate(R.layout.searchlist, container, false);
    listView = (AbsListView) rootView.findViewById(R.id.movieslist);
    listView.setOnItemClickListener(this);
    toastLoadingMore = Toast.makeText(getActivity(), R.string.loadingMore, Toast.LENGTH_SHORT);
    activity = ((MainActivity) getActivity());

    Tracker t = ((MovieDB) activity.getApplication()).getTracker();
    t.setScreenName("Search");
    t.send(new HitBuilders.ScreenViewBuilder().build());

    return rootView;
}
 
Example 4
Source File: LibraryFragment.java    From TextFiction with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.fragment_library, null, false);

	// Set the adapter
	mListView = (AbsListView) view.findViewById(android.R.id.list);
	mListView.setEmptyView(view.findViewById(android.R.id.empty));
	((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter);

	// Set OnItemClickListener so we can be notified on item clicks
	mListView.setOnItemClickListener(this);
	
	reScan();
	return view;
}
 
Example 5
Source File: WhiteListFragment.java    From android-overlay-protection with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_whitelist, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    mListView.setEmptyView(view.findViewById(android.R.id.empty));
    mListView.setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example 6
Source File: DetectedOverlayFragment.java    From android-overlay-protection with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_detectedoverlay, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    mListView.setEmptyView(view.findViewById(android.R.id.empty));
    mListView.setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example 7
Source File: CollectionFragment.java    From AnkiDroid-Wear with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_collection, container, false);
    collectionListContainer = view.findViewById(R.id.collectionListContainer);
    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    mListView.setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    applySettings();
    return view;
}
 
Example 8
Source File: ListFragment.java    From ListItemFold with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_item_list, container, false);
    mAdapter = new ItemDataAdapter(getActivity());
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    mListView.setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);
    DetailAnimViewGroup wrapper = new DetailAnimViewGroup(inflater.getContext(), view, 0);
    loadData();
    return wrapper;
}
 
Example 9
Source File: ChatterBoxMessageFragment.java    From pubnub-android-chat with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_chattmessage_list, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    mListView.setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example 10
Source File: ArcaSimpleAdapterFragment.java    From arca-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(FragmentUtils.getFragmentLayout(this.getClass()), container, false);
    final AbsListView listView = (AbsListView) view.findViewById(getAdapterViewId());
    listView.setOnItemLongClickListener(this);
    listView.setOnItemClickListener(this);
    return view;
}
 
Example 11
Source File: ArcaSimpleAdapterSupportFragment.java    From arca-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(FragmentUtils.getFragmentLayout(this.getClass()), container, false);
    final AbsListView listView = (AbsListView) view.findViewById(getAdapterViewId());
    listView.setOnItemLongClickListener(this);
    listView.setOnItemClickListener(this);
    return view;
}
 
Example 12
Source File: IntentItemFragment.java    From android-intents with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_intentitem, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    ((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example 13
Source File: ItemFragment.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_item, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    ((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example 14
Source File: StreamFragment.java    From gplus-haiku-client-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    AbsListView list = getListView();
    list.setAdapter(mAdapter);
    list.setOnItemClickListener(this);
}
 
Example 15
Source File: AbsListViewExampleActivity.java    From Paginate with Apache License 2.0 4 votes vote down vote up
@Override
protected void setupPagination() {
    if (paginate != null) {
        paginate.unbind();
    }
    handler.removeCallbacks(fakeCallback);
    adapter = new PersonAdapter(this, DataProvider.getRandomData(20));
    loading = false;
    page = 0;

    int layoutId;
    switch (absListViewType) {
        case LIST_VIEW:
            layoutId = R.layout.listview_layout;
            break;
        case GRID_VIEW:
            layoutId = R.layout.gridview_layout;
            break;
        default:
            layoutId = R.layout.listview_layout;
            break;
    }

    getContainer().removeAllViews();
    LayoutInflater.from(this).inflate(layoutId, getContainer(), true);

    AbsListView absListView = (AbsListView) findViewById(R.id.abs_list_view);
    if ((absListView instanceof ListView) && useHeaderAndFooter) {
        ListView listView = (ListView) absListView;
        listView.addHeaderView(LayoutInflater.from(this).inflate(R.layout.list_view_header, absListView, false));
        listView.addFooterView(LayoutInflater.from(this).inflate(R.layout.list_view_footer, absListView, false));
    }

    absListView.setAdapter(adapter);
    absListView.setOnItemClickListener(this);
    absListView.setOnItemLongClickListener(this);

    paginate = Paginate.with(absListView, this)
            .setOnScrollListener(this)
            .setLoadingTriggerThreshold(threshold)
            .addLoadingListItem(addLoadingRow)
            .setLoadingListItemCreator(customLoadingListItem ? new CustomLoadingListItemCreator() : null)
            .build();
}
 
Example 16
Source File: AbsListViewQuickReturnAttacher.java    From QuickReturn with MIT License 4 votes vote down vote up
public AbsListViewQuickReturnAttacher(AbsListView listView) {
  this.absListView = listView;
  listView.setOnScrollListener(onScrollListener);
  listView.setOnItemClickListener(this);
  listView.setOnItemLongClickListener(this);
}