I am trying to display text view with 20 seconds delay in a each view page. The view page also display 1 minute delay.means,in each view page i want show three text views, on next page it will show another three text. please help me out.
private int[] ImageIds={R.drawable.image_asana,R.drawable.image_a,R.drawable.image_c,R.drawable.image_d,
R.drawable.image_e,R.drawable.end_image};
public static ScreenSlideFragment create(int PageNumber){
ScreenSlideFragment fragment=new ScreenSlideFragment();
Bundle args=new Bundle();
args.putInt(ARG_PAGE, PageNumber);
fragment.setArguments(args);
return fragment;
}
public ScreenSlideFragment(){
}
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
mPageNumber=getArguments().getInt(ARG_PAGE);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.fragment_screenslide_page, container, false);
((ImageView)rootView.findViewById(R.id.image3)).setImageResource(ImageIds[mPageNumber]);
if (mPageNumber==ImageIds.length) {
handler.removeCallbacks(null);
}
final Runnable textUpdtae = new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
((TextView) rootView.findViewById(R.id.imagetextview)).setText(ImageTextIds[count++]);
}
};
newTimer = new Timer();
newTimer.schedule(new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
handler.post(textUpdtae);
}
}, 0, 5000);
return rootView;
}
You can try setting layoutanimation to viewpager object. This animation will be applied to every view that view pager contains.