I am trying to get the docx file as shown below
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == MainActivity.RESULT_OK) {
if (resultCode == RESULT_OK) {
// Get the Uri of the selected file
Uri uri = data.getData();
String uriString = uri.toString();
File myFile = new File(uriString);
String path = myFile.getAbsolutePath();
filepath =path;
String displayName = null;
if (uriString.startsWith("content://")) {
Cursor cursor = null;
try {
cursor = this.getContentResolver().query(uri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
txtFilename.setText(displayName);
filename = displayName;
}
} finally {
cursor.close();
}
} else if (uriString.startsWith("file://")) {
displayName = myFile.getName();
txtFilename.setText(displayName);
filename = displayName;
}
}
}
}
Now the result is :
Path: /content:/com.estrongs.files/storage/emulated/0/Download/Imp%20Values.docx
Filename: Imp Values.docx
Now how do I convert this document to base64 ?
Thanks in advance.