我正在尝试使用eclipse工作区阅读安卓应用程序的Excel表格。我把文件路径,但它似乎甚至没有找到它。我需要在某处声明文件的路径吗?阅读安卓程序的Excel表格
以下是我的代码。感谢您的帮助!
public void onCreate(Bundle savedInstanceState) {
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // calls VIBRATOR_SERVICE when button is pressed
screensize = getScreenSize();
setTheme(android.R.style.Theme_Translucent_NoTitleBar);
super.onCreate(savedInstanceState);
Eula.show(this); // displays the EULA and asks user to Accept or Don't Accept
try{
fs = new FileInputStream(new File("/Users/paul/Desktop/CollegeTrack/Samp.xls"));
InputStream fileinput = fs;
try{
Workbook workbook = Workbook.getWorkbook(fileinput);
sheet = workbook.getSheet(0);
database_array = Database.classDatabase(sheet); //stores each row in an array
workbook.close();
}
catch (BiffException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
fs.close();
}
catch (IOException e) {
e.printStackTrace();
}
savedAssignments_array = Database.assignmentDatabase();
savedCourses_array = Database.savedCourses();
goToWelcomeScreen();
}
你有什么例外。这个看起来很正确。你可能会得到一个IOException。你读过异常堆栈跟踪吗? – 2011-04-19 16:27:14