i am making an app and i have done this till now.
public class TrafficAdd extends Activity{
Button take,upload;
EditText sub,details;
Bitmap bmp;
Intent i;
ImageView iv;
final static int cameraData=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.trafficadd);
InputStream is=getResources().openRawResource(R.drawable.green);
bmp=BitmapFactory.decodeStream(is);
take=(Button) findViewById(R.id.trafficcamera);
upload=(Button) findViewById(R.id.trafficupload);
sub=(EditText) findViewById(R.id.eTtrafficSub);
details=(EditText) findViewById(R.id.eTtrafficDetails);
iv=(ImageView) findViewById(R.id.trafficpic);
take.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i,cameraData);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK){
Bundle extras=data.getExtras();
bmp=(Bitmap) extras.get("data");
iv.setImageBitmap(bmp);
}
}
}
I am taking the picture from camera and i am able to set it as Bitmap bmp. Now i need to save this bmp somewhere in SD card and retrieve it later it to view. Please help!!!