Skip to content

Instantly share code, notes, and snippets.

@bharath2020
bharath2020 / CameraFlash-TurnOFF
Created January 23, 2015 19:11
Switch ON / OFF Flash in Android
public void turnOFF()
{
param = cam.getParameters();
param.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
cam.setParameters(param);
cam.stopPreview();
cam.release();
cam=null;
}
@bharath2020
bharath2020 / gist:7287ffe7a0a1225a316d
Created August 8, 2014 23:06
HTTPUrlConnection redirect once
urlConnection = (HttpURLConnection) imageURL.openConnection();
String location = urlConnection.getHeaderField("Location");
if (location != null )
{
URL newURL = new URL(location);
urlConnection = (HttpURLConnection) newURL.openConnection();
}
//use the urlConnection now