Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 03-01-2011, 07:30 AM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Dec 2010
Posts: 12
Default How to get a file path from c drive in android


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.
thomas6188 is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Charan

Advertisement




All times are GMT +5.5. The time now is 03:24 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2