When i click the button nothing happens; i have given external write permissions in manifest file. What is wrong? Thank you in advance.
(code is jumbled up i will straighten it later sorry)
Here's my code:
excelButton.setOnClickListener(
new Button.OnClickListener(){
public void onClick(View v) {
String s = excelName.getText().toString();
Label label;
String Fnamexls = s + ".xls";
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File(sdCard.getAbsolutePath() + "/newfolder");
directory.mkdirs();
File file = new File(directory, Fnamexls);
excelWriter f = new excelWriter();
WorkbookSettings wbSettings = new WorkbookSettings();
wbSettings.setLocale(new Locale("en", "EN"));
WritableWorkbook workbook;
try {
workbook = Workbook.createWorkbook(file, wbSettings);
//workbook.createSheet("Report", 0);
WritableSheet sheet = workbook.createSheet("First Sheet", 0);
for(int x = 0; x<MainActivity.kolonAdi.size();x++){
for(int y = 0; y<MainActivity.rowAdet;y++){
label = f.excelWriterClass(x,y,enterValues.table[x][y].toString());
try {
sheet.addCell(label);
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
workbook.write();
try {
workbook.close();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//createExcel(excelSheet);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}});
This is the label class;
package angrybabysoftware.statisticalsoftware;
import jxl.write.Label;
public class excelWriter {
public Label excelWriterClass (int a, int b, String c){
Label label = new Label(a,b,c);
return label;
}
}
Checked for runtime permissions and it started working. thank you Gabe Sechan.