reg file not found

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 3

Nov 28, 2018, 7:40:26 AM via Website

Hi,
I am trying to develop an android app using android studio 3.2.1. and running in emulator.
I am trying to access an excel workbook as database which is in my local system.I imported the required poi jars in LIBS folder. File not found exception is thrown.
Help me to resolve this problem.

code:

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    try {

      FileInputStream inp = new FileInputStream(new File("C:\\Users\dosh\\Building.xlsx"));
        XSSFWorkbook wb = new XSSFWorkbook(inp);
        XSSFSheet sheet = wb.getSheetAt(0);
        Row row = sheet.getRow(3);
        Cell cell = row.getCell(2);
        cell.setCellValue(200);
        Log.d("FILE","found the excel file");
        println("File not found");

    }
    catch(Exception e) {

        Log.d("NO FILE","Unable to find the excel file");

    }
}

}

Be the first to answer

Recommended articles