tags:

views:

8

answers:

0

Hi Friends,

String PATH = Environment.getExternalStorageDirectory()+"/file2.png"; 
URL url = new URL("http://theblacksheeponline.com/assets/images/galleries95/big_62596549_photo.JPG"); //you can write here any link
 File file = new File(PATH);
 URLConnection ucon = url.openConnection();
int len=ucon.getContentLength();
InputStream is = ucon.getInputStream();
 BufferedInputStream bis = new BufferedInputStream(is);
 ByteArrayBuffer baf= new ByteArrayBuffer(len);
int current = 0;
 while ( (current=bis.read())!= -1)
 {

  baf.append((byte)current);
  }
FileOutputStream fos = new FileOutputStream(file);
fos.write(baf.toByteArray());  
fos.close();

i am using this kind of code,i want to see file2.png in sdcard and i want to store that file in camerimage in device,how can i write the code for that,anybody knows,please give sample code for me..