How To Flip Android Flash Light
===

im working an simple torch app . I want to flip backflash light faster. I tried following code but its very slowly. How can i faster flip then following code ? 


    public class mainActivity extends Activity {
    	/** Called when the activity is first created. */
    	private Camera cam;
    	private Parameters p;
    	private boolean lightOn = false;
    	@Override
    	public void onCreate(Bundle savedInstanceState) {
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.main);
    		cam = Camera.open();
    		p = cam.getParameters();
    
    		
    		Button b1 = (Button)findViewById(R.id.button1);
    		b1.setOnClickListener(new OnClickListener() {
    			
    			public void onClick(View v) {
    				while(true){
    						if(lightOn){
    							p.setFlashMode(Parameters.FLASH_MODE_OFF);
    							cam.setParameters(p);
    							cam.stopPreview();
    							lightOn = false;
    						}else{
    							p.setFlashMode(Parameters.FLASH_MODE_TORCH);
    							cam.setParameters(p);
    							cam.startPreview();
    							lightOn = true;
    						}
    				}
    				
    			}
    		});
    		
    	}
    	
    }