把资源文件读到sd卡目录下
public class ActivityMain extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
InputStream is = getResources().openRawResource(R.drawable.android);
OutputStream ops = null;
try{
ops = new FileOutputStream("/sdcard/a.jpg");
byte[] b = new byte[1024];
int len = -1;
while((len = is.read(b))!=-1){
ops.write(b, 0, len);
}
ops.flush();
}catch(Exception e){
e.printStackTrace();
}
finally{
try {
is.close();
ops.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}