Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8096175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:22:09+00:00 2026-06-05T21:22:09+00:00

i Tried to get data from excel in java. if i execute it as

  • 0

i Tried to get data from excel in java. if i execute it as normal java program i am getting data from excel and it is getting printed in console.But when i put it my Robotium test project, i am getting null pointer exception(file or directory not found).

public void testCanOpenSettings() throws IOException, Exception {
    loginvalid();   
}

public void Eula() {

    if(solo.searchText("Accept"))
    { 
        System.out.println(" Eula accept");
        solo.clickLongOnText("Accept"); 
    }
}

public void loginvalid() throws IOException  {
    String username;
    String password;
    solo.sendKey(Solo.MENU);
    solo.sleep(3000);
    solo.clickLongOnText("Sign In");
    solo.sleep(3000);
    //solo.clearEditText(0);
    username = Readexcel(0,0);
    password = Readexcel(0,1);
    solo.enterText(0,username);
    solo.enterText(1, password);
    solo.clickOnCheckBox(0);
    solo.clickLongOnText("Sign In");

}
public static String Readexcel(int row,int col) throws IOException  { 
    String filename = "C://Documents//Robo//robo1.xls";
    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();strong text
        return null;
    } 

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:22:10+00:00Added an answer on June 5, 2026 at 9:22 pm

    You are reading the file C://Documents//Robo//robo1.xls, that is stored on your computers HardDrive which your phone of course can’t access. You need to put the file on your phone SD-card and use the uri to that location instead:

    File storage = Environment.getExternalStorageDirectory() //Returns sd-card
    String filename = "robo1.xls"; //file name, may have path separators
    File myfile = new File(storage, filename);
    //myfile is now a File object that you can use, to get the path, use myfile.getAbsolutePath()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need query to get data between two days.I tried with this.But it gives
I have a program that takes data from an excel file and manipulates it
I'm trying to export data from a web app into excel, but there is
One of my users wants to get data into Excel from SQL 2008 query/stored
Does anyone know the fastest way to get data from and Excel table (VBA
I have a windows phone 7.1 app that tries to get data from a
Magento 1.6.1 I am trying to get form data on my observer. I tried
I have tried following queries to get my facebook fan page insights data SELECT
I've tried every combination to import binary data for Mongo and I CANNOT get
I tried to get an answer from server and conver it to JSONObject .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.