Java 无法使用Robotium从excel工作表读取数据

Java 无法使用Robotium从excel工作表读取数据,java,android,excel,robotium,Java,Android,Excel,Robotium,我无法从excel工作表中读取数据。请帮帮我。 下面是我正在使用的代码。在excelsheet中,我有两个冒号-用户名和密码,两个都有值。我已经将test.xls文件放在平板电脑的内存中 //读取excel文件 public static String Readexcel(int row,int col) throws IOException { File storage = Environment.getExternalStorageDirectory(); Strin

我无法从excel工作表中读取数据。请帮帮我。
下面是我正在使用的代码。在excelsheet中,我有两个冒号-用户名和密码,两个都有值。我已经将test.xls文件放在平板电脑的内存中

//读取excel文件

public static String Readexcel(int row,int col) throws IOException  { 

    File storage = Environment.getExternalStorageDirectory();

    String filename = "test.xls";
    File myfile = new File(storage, filename);
    String s = "";

    try
    {
        FileInputStream fis = new FileInputStream(filename);
        HSSFWorkbook myWorkBook = new HSSFWorkbook(fis);
        HSSFSheet mySheet = myWorkBook.getSheetAt(0);
        HSSFRow row1 = mySheet.getRow(row);
        HSSFCell cell1 = row1.getCell(col);
        s = cell1.getRichStringCellValue().getString();
        System.out.println("Cell 1 : "+s);
        Log.d("cell value",s );

        System.out.println(s);
            return s;

    }
    catch (IOException e) {
        e.printStackTrace();
        return null;
    } 

    }


RoboMxtouchTeacher]在8087_09FC_Medf1上启动instrumentation android.test.InstrumentationTestRunner[RoboMxtouchTeacher]向Eclipse发送测试信息RoboMxtouchTeacher]测试运行失败:由于“java.lang.NullPointerException”RoboMxtouchTeacher]测试运行完成,测试运行失败,因此存在NullPointerException,哪一行?它没有显示该错误出现的任何行。这是从设备内部内存访问xls文件的正确方法吗?
public void test1invaliedcredentials() throws Exception{    

    String username;
        String password;
    solo.sleep(2000);
    solo.clearEditText(0);

    solo.clearEditText(1);
    solo.clearEditText(2);
    username = Readexcel(0,0);
        password = Readexcel(0,1);
        solo.enterText(0,username);
        solo.enterText(1, password);
    solo.clickOnButton(0);
}