Code example for ViewFlipper

Methods: setFlipInterval

0
		int[] frames = FrameUtil.frame2int(frame);
		frames=FrameUtil.autoAdjust(frames, context);
		FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(frames[2], frames[3]);
		params.setMargins(frames[0], frames[1],0,0);
		setLayoutParams(params);
		viewFlipper=new ViewFlipper(context);
		addView(viewFlipper);
		linear=new LinearLayout(context);
		linear.setGravity(Gravity.LEFT|Gravity.BOTTOM);
		linear.setOrientation(LinearLayout.HORIZONTAL);
		List<Picture> pictures=shutter.getPictures();
		for(int i=0;i<pictures.size();i++){
			ImageView img=new ImageView(context);
			String resource=pictures.get(i).getResource();
			img.setTag(resource);
			img.setId(i);
			viewFlipper.addView(img);
			Button btn=new Button(context);
			btn.setText(String.valueOf(i+1));
			btn.setTag(i);
			android.widget.LinearLayout.LayoutParams params_=new android.widget.LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			params_.setMargins(30, 0, 0, 0);
			btn.setLayoutParams(params_);
			if(i==0){
				btn.setBackgroundColor(Color.RED);
			}else{ 
				btn.setBackgroundColor(Color.WHITE);
			} 
			linear.addView(btn);
		} 
		addView(linear);
		setFocusable(false);
		viewFlipper.setFlipInterval(shutter.getInterval()*1000);
	} 
	 
	public void loadResource(){ 
		int count=viewFlipper.getChildCount();
		for(int i=0;i<count;i++){
Contextual code suggestions in your IDE  Get Codota for Java