I am developing one application. I use uploading the image to sdcard, getting the image from the uri, it is converted to a byte array, how can I implement it I'm a new developer in android I save this image in a byte array in the database backend, please forward some solution ....
startActivityForResult(new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), 1);
}
public void onActivityResult(int requestCode,int resultCode,Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK)
{
Uri selectedImage = data.getData();
Cursor cur = PhotoImage.this.managedQuery(selectedImage, null, null, null, null);
if(cur.moveToFirst())
{
long Length = cur.getLong(cur.getColumnIndex(ImageColumns.SIZE));
try{
String Image=Base64.encodeBytes(selectedImage.getPath().getBytes());
Log.v("check",Image);
byte[] bytedata = new byte[(int) Length];
FileOutputStream fos=new FileOutputStream(Img);
fos.write(bytedata[0]);
fos.close();
}
catch (Throwable th)
{}
:
12-30 13:00:24.619: VERBOSE/check(773): L2V4dGVybmFsL2ltYWdlcy9tZWRpYS8y
this is the output to the display, which, I think, is not converted to an array of bytes, please, some solution ..
source
share