private void setUpFlip() { viewFlipper = (ViewFlipper) this.findViewById(R.id.viewflipper); gestureDetector = new GestureDetector(new MyGestureDetector()); gestureListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }; for (int i = 0; i < images.length; i++) { viewFlipper.addView( createImageView(i), new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); } setUpAnimation(); imageDescriptionTextView = (TextView) this.findViewById(R.id.textView2); testView = (TestView) this.findViewById(R.id.testView1); testView.setTotalAndIndex(imageDescription.length, 0); handler = new Handler() { public void handleMessage(Message message) { flipRight(); } }; }
private void changeDisplay() { ImageDescriptionHolder holder = (ImageDescriptionHolder) viewFlipper.getCurrentView().getTag(); imageDescriptionTextView.setText(holder.description); testView.setTotalAndIndex(imageDescription.length, holder.index); }