I am trying to get the information from an editable text field in my application to show in an excel document. The user will enter his/her name on a form and when they submit it, it will go out as a .xls file with some other information. I have the Apache POI imported and building the sheet is not a problem at all, just getting the information from the text field in the cell. I have tried to use name.getText().toString(), and just using name by itself, but it gives me the error “Cannot make a static reference to the non-static field name”. I have tried the options it gives for setCellValue and everything else it recommends in eclipse and tried with and without quoates. The filed I am trying to reference is called name.
//Name
HSSFCell cellH2 = rowH.createCell(3);
firstSheet.addMergedRegion(new CellRangeAddress(7,7,3,4));
cellH2.setCellValue(new HSSFRichTextString("Tester's Name"));
HSSFCell cellH3 = rowH.createCell(5);
cellH3.setCellValue ();
Your problem has nothing to do with Android, EditText, or Excel.
Your problem is simply that you are trying to reference a non-static field from inside of a static method. Either remove the “static” qualifier from the method’s signature or make the field static.