I don’t know , why I am getting null from BitmapFactory.decodeFile(String imagePath) method.
imagePath is perfect.Code is below here .
public static byte[] imageToByteArray(String imagePath){
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG , 100 , byteArrayOutputStream);
return byteArrayOutputStream.toByteArray();
}
imaagePath is a internet specific path .Here I am using google place api and imagePath is location of image given by google web service.
decodeFile is use to get
Bitmapfrom local File system.To get
Bitmapfrom internet useDo not forget to run above line in background thread.