public void readToFile( String fileName ) {
		// String fileName = Environment.getExternalStorageDirectory()
		//		+ "/sample.txt";

		FileInputStream fis = null;

		try {
			TextView txtinput = (TextView) findViewById( R.id.input_text_id);
			fis = new FileInputStream(fileName);

			byte[] readBytes = new byte[fis.available()];
			fis.read(readBytes);
			String readString  = new String(readBytes);

			txtinput.setText( readString );
			Log.v("readString", readString);
		} catch (FileNotFoundException ex) {
			ex.printStackTrace();
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha