# How to get a file path from c drive in android



## thomas6188 (Jan 3, 2011)

I was trying to extract the content of a pdf file and display its content in android. I tired the code in java and it worked.But when i am coding it in android, its not displaying anything. I think, its not getting the file path. I have this pdf file in my pc whose content i want to extract. where should i store this file so that i can get its path in a string? How to get the path? The code is given below:

public class hello extends Activity {
      /** Called when the activity is first created. */
        private static String INPUTFILE = "FirstPdf.pdf";
        String str;


      @Override

  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {
    Document document = new Document();


    document.open();
    PdfReader reader = new PdfReader(INPUTFILE);

    int n = reader.getNumberOfPages();
       str=PdfTextExtractor.getTextFromPage(reader, 2);

    } catch (IOException e) {

        //e.printStackTrace();
    } catch (InterruptedException e) {

        e.printStackTrace();
    }
    TextView tv = new TextView(this);
    tv.setText(str);
    setContentView(tv);
   }
}

I would be very grateful if the problem is solved.


----------

