9 messages in com.googlegroups.android-developersRe: [android-developers] Re: HOW TO O...
FromSent OnAttachments
bhushank29 Jan 2008 22:36 
noha mansour29 Jan 2008 23:56 
bhushank30 Jan 2008 00:28 
noha mansour30 Jan 2008 01:23 
Dan U.30 Jan 2008 01:41 
noha mansour30 Jan 2008 02:54 
bhushank30 Jan 2008 04:23 
noha mansour30 Jan 2008 04:58 
acopernicus30 Jan 2008 06:26 
Subject:Re: [android-developers] Re: HOW TO OPEN FILE IN ANDROID WHICH IS AT REMOTE LOCATION?
From:noha mansour (noha@gmail.com)
Date:01/30/2008 04:58:37 AM
List:com.googlegroups.android-developers

i am really thanking you for your replies i push the file manually but still have FileNotFound exception for your problem check this links http://www.javapractices.com/topic/TopicAction.do?Id=42 //begin reading from main method http://www.exampledepot.com/egs/java.io/ReadLinesFromFile.html i hope help you

On Jan 30, 2008 2:24 PM, bhushank <bhus@gmail.com> wrote:

hi... the file is getting created in /data/data/files folder. u can see it on command prompt. How can we read a file which on our machine using core java? (No Android here) tha file may be .pdf or .ppt. Please help me out... Thanks..

On Jan 30, 3:54 pm, "noha mansour" <noha@gmail.com> wrote:

can you describe how can i push file into device? i try to push file from eclipse but "Failed to push the items" msg displayed in the console

On Jan 30, 2008 11:42 AM, Dan U. <dan.@gmail.com> wrote:

You most likely will want to push the file onto the emulator. I think it's one of the options provided with adb.

On Jan 30, 12:28 am, bhushank <bhus@gmail.com> wrote:

Here is the code which i was using... here i m creating one file, writing one Teststring to it.. and again reading the same...

------------------------------------------------------ public class FileRead_Activity extends Activity { private static final String TESTSTRING = "Tag Bhushan String" ; Context ctx;

/** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); try { FileOutputStream fOut = openFileOutput("samplefile.txt",MODE_WORLD_READABLE); OutputStreamWriter osw = new OutputStreamWriter(fOut);

osw.write(TESTSTRING); osw.flush(); osw.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try {

FileInputStream fin = openFileInput("samplefile.txt "); InputStreamReader isr = new InputStreamReader(fin); int fileSize = fin.available(); char[] inputBuffer = new char[fileSize]; isr.read(inputBuffer);

// Transform the chars to a String String readString = new String(inputBuffer);

String []str = readString.split(" ");

NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

nm.notifyWithText(0,str[0], NotificationManager.LENGTH_SHORT, null);

} catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }

-------------------------------------------------- but i want to read from a file which is present on our machine(eg. pdf file) please suggest if you can...... Thanks. }

noha mansour wrote:

can you send the code you use to create file?

On Jan 30, 2008 8:36 AM, bhushank <bhus@gmail.com> wrote:

Hi All. Im trying to read from a file. but able to read only those files which i've created. I want to read from a file which on my machine. like (some .pdf or .ppt). how can i do tht? Any suggestions.... Somebody must have done this... Please help me

out..

Thanks....^ _ ^