đây báo cáo chứa đường dẫn (pathname trong sdcard ở định dạng chuỗi)Làm thế nào để chuyển đổi tệp sang Base64?
File dir = Environment.getExternalStorageDirectory();
File yourFile = new File(dir, report);
String encodeFileToBase64Binary = encodeFileToBase64Binary(yourFile);
private static String encodeFileToBase64Binary(File fileName) throws IOException {
byte[] bytes = loadFile(fileName);
byte[] encoded = Base64.encodeBase64(bytes);
String encodedString = new String(encoded);
return encodedString;
}
trong byte [] dòng mã hóa nhận được lỗi này. Phương pháp này encodeBase64 (byte []) là undefined cho các loại Base64
là câu hỏi của bạn: những gì nên được sử dụng thay vì 'encodeBase64' trong bối cảnh Android? Bạn đã thử http://developer.android.com/reference/android/util/Base64.html encode() API chưa? – sandrstar