Code example for RadioGroup

Methods: getChildCountcheck

0
			tablist.check(0);
		return id;
	} 
 
	protected void selectScreen(int num) {
		tablist.check(num);
	} 
 
	class PageScroller extends HorizontalScrollView {
		boolean touch;
		int minfling;
 
		public PageScroller(Context ctx) {
			super(ctx);
			setHorizontalScrollBarEnabled(false);
			setSmoothScrollingEnabled(true);
			setHorizontalFadingEdgeEnabled(false);
			minfling = ViewConfiguration.get(ctx).getScaledMinimumFlingVelocity();
		} 
 
		VelocityTracker vt = null;
		public boolean onTouchEvent(MotionEvent event) {
			if (vt == null)
				vt = VelocityTracker.obtain();
			vt.addMovement(event);
 
			if (event.getAction() == MotionEvent.ACTION_UP) {
				final int x = getScrollX();
				final int bump = getWidth() / 2 + 1;
				int on = x2n(x), nn = on;
 
				vt.computeCurrentVelocity(1000);
				float velocity = vt.getXVelocity();
 
				if (Math.abs(velocity) > minfling)
					nn = x2n(x + (velocity < 0 ? bump : -bump));
 
				selectScreen(on);
				touch = false;
 
				if (nn == on)
					smoothScrollTo(n2x(on), 0);
				else 
					selectScreen(nn); // this will scroll too
 
				vt.recycle();
				vt = null;
				return true; 
			} 
 
			touch = true;
			return super.onTouchEvent(event);
		} 
 
		private int x2n(int x) {
			int max = tablist.getChildCount() - 1;
			int w = getWidth();
			if (w == 0)
				return 0; 
			int n = (x + w / 2) / w;
			if (n < 0)