Есть метод onClick, в который я хочу поместить другой метод, реализующий intent и apache poi, когда я его помещаю выдает ошибку. Какие параметры нужно в него передать, чтобы реализовать этот метод в onClick?
public void appointButtonClick(View view) {
readExcelData();
}
public void readExcelData(String ExcelFilePath) {
// HSSFWorkbook is for .xls
// XSSFWorkbook is for .xlsx
String[] path = ExcelFilePath.split(":");
Workbook workbook = null;
if (ExcelFilePath.endsWith(".xls")) {
try {
InputStream inputStream = new FileInputStream(new File(path[1]));
workbook = new HSSFWorkbook(inputStream);
} catch (FileNotFoundException e) {
Log.i("debinf cliinf", "readExcelData: FileNotFoundException " + e.getMessage());
} catch (IOException e) {
Log.i("debinf cliinf", "readExcelData: Error reading InputStream " + e.getMessage());
}
} else if (ExcelFilePath.endsWith(".xlsx")) {
try {
InputStream inputStream = new FileInputStream(new File(path[1]));
workbook = new XSSFWorkbook(inputStream);
} catch (FileNotFoundException e) {
Log.i("debinf cliinf", "readExcelData: FileNotFoundException " + e.getMessage());
} catch (IOException e) {
Log.i("debinf cliinf", "readExcelData: Error reading InputStream " + e.getMessage());
}
}
Log.i("debinf cliinf", "uri is " + ExcelFilePath.endsWith(".xls"));
Sheet sheet = workbook.getSheetAt(0);
Log.i("debinf cliinfo", "sheet is " + sheet);
if (sheet == null) {
return;
}
}