Wednesday, 15 April 2015

android - ListView.getItemAtPosition(i) equivalent in RecyclerView? -


I am migrating from a ListView supported by a CursorAdapter, a RecyclerView is supported by shywim.

I'm having trouble getting rid of a cursor object used to go back:

  (MyCursor) mListView.getItemAtPosition (i)  

How to get access to the cursor in a specific situation inside the recyclableview? Thank you.

"itemprop =" text ">

Unfortunately this is not part of RecyclerView. To define I define an interface:

  Public Interface OnItemClickListener {Public Zero onItemClick (see View, Integer Status); }  

ViewHolder implements View.OnClickListener, and its creator takes an object that implements my OnItemClickListener interface:

  public static class ViewHolder See Reach RecyclerView.ViewHolder Apply. OnClickListener {Private OnItemClickListener mListener; Public viewer (see item see) {super (item view); ItemView.setOnClickListener (this); } Public viewer (see item, see ITemClickListener listener) {this (itemView); MListener = Listener; } @Override Public Zero onClick (see v) {if (mListener = null!) {MListener.onItemClick (V, getPosition ()); }}  

When you click on a row, I click the viewer to view and its status is


No comments:

Post a Comment