Please bare my English
How can I upload the captured image in the database?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_main );
camera = (ImageButton) findViewById( R.id.camera );
camera.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog = new Dialog( MainActivity.this );
dialog.setContentView( R.layout.camera_gallery );
dialog.setTitle( "Upload Image" );
dialog.setCancelable( true );
dialog.show();
capture = (Button) dialog.findViewById( R.id.capture );
download = (Button) dialog.findViewById( R.id.download );
capture.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE );
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
getFileUri();
i.putExtra(MediaStore.EXTRA_OUTPUT, file_uri);
startActivityForResult(i, 10);
}
} );
download.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent( Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI );
intent.setType("image/*");
startActivityForResult( intent, gallery );
}
} );
}
} );
}
private void getFileUri() {
image_name = "testing123.jpg";
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
+ File.separator + image_name
);
file_uri = Uri.fromFile(file);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//code here
}
}
Here I want to Add the captured image into my database that too in original size, not the thumbnail.
And I have one more regarding MySQL. Can we store the Image file in the database and if not then how do they store images.
And Also any suggestion to how to store my captured image in internal storage.