Hi Mark,
I tried the following code. Although the byte array returns me some
valid length,
I am doubtful if this is returning me the correct data, because our
server throws
an error when I encode the bye array into Base 64 format. Please
check. Thanks.
try {
InputStream inStream =
getApplicationContext().getContentResolver().openInputStream(uri);
int length = inStream.available();
byte [] bytes = new byte[length];
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead = inStream.read(bytes,
offset, bytes.length-offset)) >= 0) {
offset += numRead;
}
Log.v(TAG, "Byte Array: " + bytes.length);
String encodedString = Base64.encodeToString(bytes, Base64.DEFAULT);
} catch (IOException e) {
e.printStackTrace();
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en