Reputation: 3264
I recorded videos through my app,And i stored in memory card.
After i get those videos and added to list view .
Based on screen size only one video is visible to user.
If user scroll up and down and stop.
At that point i want to know which one is in front of user.
If any one know the solution please help me.or any other way to do
Thanks in advance
Upvotes: 3
Views: 4848
Reputation: 4112
As you are showing only one item of list so you can create a function in your Adapter class that will gives you id of currently visible child. like
public class MyAdapter extends BaseAdapter{ int slectedChild; // selectedChild will save currently visible child's id
public int getSelectedChild(){ // this function will return id of currently visible child
return selectedChild;
}// public View getView(int position, View convertView, ViewGroup container)
{selectedChild=position; // update value selectedChild in side getView() function.
....
}
}
Upvotes: 0
Reputation: 1793
Given Marek Sebera's comment - it is indeed true that getView
won't be 100% reliable, you can just use getFirstVisiblePosition
in the adapter.
(That should be enough if only one video is visible at a time.)
Upvotes: 0