I developing one application , in that i having view pager to display different video image, there are n number of pager screen,
All page is auto slide like following .
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
ViewGroup v=(ViewGroup)inflater.inflate(R.layout.fragment_home, container, false);
ButterKnife.bind(this, v);
/*Snackbar.make(v, "Home Fragment", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();*/
//Toast.makeText(getActivity(),"home Fragment",Toast.LENGTH_LONG).show();
viewPager.setAdapter(new MyPagerAdapter());
t=new Thread(){
@Override
public void run()
{
try {
while(true) {
count %= size;
Log.w("slide", "" + count);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
viewPager.setCurrentItem(count);
}
});
count++;
Thread.currentThread().sleep(5000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
//t.start();
return v;
}
I want to stop auto slide pager when i touch to this particular pager , when i remove my finger from the pager then auto slide of pager started and stop on again touch, how to fulfill this functionality?