Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - File handeling in android

File handeling in android

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

File handeling in android

Postby vani.golakoti » Sat Jun 26, 2010 10:03 am

Hi all,

If i insert a file(like a text file) in sdcard and i want to read and edit the file on the device(emulator), how can i achieve that.

Regards,
bhavani.G
vani.golakoti
Freshman
Freshman
 
Posts: 4
Joined: Wed May 19, 2010 7:18 pm

Top

Re: File handeling in android

Postby ranjandeo » Sat Jul 10, 2010 6:24 am

Hi,
This is how you can write into a file and read from a file.
Different methods given below illustrate this...

public void writeIntoFile(){
FileOutputStream fOut = null;
OutputStreamWriter osw = null;
try{
fOut = openFileOutput("file.txt", Context.MODE_PRIVATE);
osw = new OutputStreamWriter(fOut);
osw.write("Write these text into file");
osw.close();
fOut.close();
}catch(Exception e){
e.printStackTrace(System.err);
}
}



public void readFromFile(){
FileInputStream fIn = null;
InputStreamReader isr = null;
try{
char[] inputBuffer = new char[1024];
String data = null;
fIn = openFileInput("file.txt");
isr = new InputStreamReader(fIn);
isr.read(inputBuffer);
data = new String(inputBuffer);
isr.close();
fIn.close();
}catch(IOException e){
e.printStackTrace(System.err);
}
}
Ranjan Deo
User avatar
ranjandeo
Experienced Developer
Experienced Developer
 
Posts: 84
Joined: Mon May 31, 2010 6:20 am
Location: Kolkata, India

Top

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests