| Author |
Message |
tim Freshman


Joined: 03 Jul 2008 Posts: 7
|
Posted: Wed Sep 03, 2008 1:30 pm Post subject: |
|
|
...same problem here  |
|
| Back to top |
|
 |
|
|
 |
haden Experienced Developer

Joined: 11 Sep 2008 Posts: 74
|
Posted: Wed Oct 22, 2008 9:49 am Post subject: |
|
|
| Nice tutorial plusminus.. Was really helpful in many ways.. |
|
| Back to top |
|
 |
rakesh_mehta Experienced Developer


Joined: 14 Oct 2008 Posts: 73 Location: Ahmedabad(India)
|
Posted: Wed Oct 22, 2008 9:56 am Post subject: |
|
|
Nice Tutorials plus minus..
Thanks man....  _________________ Rakesh |
|
| Back to top |
|
 |
dinoguan Freshman

Joined: 11 Nov 2008 Posts: 4
|
Posted: Tue Nov 11, 2008 6:26 am Post subject: File Writing Performance |
|
|
Just wondering what kind of file writing performance you guys are experiencing.
I am just writing a list of floats in a short string to a file on the SD card. Interestingly I am getting the exact same performance in the emulator as when I test on the actual device!
Anyway it is taking about 4.7 seconds to write 57 entries of something like this
"[0.166][0.00][-0.02][0.00]"
so 26bytes * 57 entries = 1482bytes in 4.7 seconds = 315 bytes per second.
I am using the standard java FileWriter to write to the sd card.
The only things I can think of is that I am writing from a view, not from an activity, so perhaps there is some overhead or permissions difference?
And I am just doing it in a loop all at once.
Thanks, Andrew |
|
| Back to top |
|
 |
androooooid Junior Developer

Joined: 26 Sep 2008 Posts: 17
|
Posted: Wed Nov 19, 2008 9:38 am Post subject: |
|
|
Is it possible to see the file though file explorer
The code seems to work but I can't see where the file is through DDMS or File Explorer. |
|
| Back to top |
|
 |
dinoguan Freshman

Joined: 11 Nov 2008 Posts: 4
|
Posted: Fri Nov 28, 2008 9:42 pm Post subject: Re: File Writing Performance |
|
|
Well I figured out what my problem was. And it was much more general than just writing to a file. As I took my file.write call out of my loop, and just appended everything to one big string then dumped it to the file all at once. And it was still taking just as long to write!
Long story short, it was String.format(). Which has horrible performance! It was taking about a whole second to format 40 floats to %.2f. I was using this elsewhere also and it was significantly hurting my framerate.
Anyway, I now just have to do w/o string.format unless it is a one time call.
So my filewriter now writes 200 entries in a little over a second, much much better.
| dinoguan wrote: | Just wondering what kind of file writing performance you guys are experiencing.
I am just writing a list of floats in a short string to a file on the SD card. Interestingly I am getting the exact same performance in the emulator as when I test on the actual device!
Anyway it is taking about 4.7 seconds to write 57 entries of something like this
"[0.166][0.00][-0.02][0.00]"
so 26bytes * 57 entries = 1482bytes in 4.7 seconds = 315 bytes per second.
I am using the standard java FileWriter to write to the sd card.
The only things I can think of is that I am writing from a view, not from an activity, so perhaps there is some overhead or permissions difference?
And I am just doing it in a loop all at once.
Thanks, Andrew |
|
|
| Back to top |
|
 |
|
|
 |
Virtue Freshman

Joined: 28 Nov 2008 Posts: 2
|
Posted: Tue Dec 02, 2008 9:16 am Post subject: How to write XML file? |
|
|
Hello plusminus,
I wrote .txt file ok, now I want to write .xml file as follows :
<?xml version="1.0"?>
<result> YES </result>
Otherwise, replace YES = NO.
But I see problem with result tag, I have to use what method in source code java??
Thanks in advance,
Virtue. |
|
| Back to top |
|
 |
Anium Freshman

Joined: 06 Jan 2009 Posts: 3 Location: France
|
Posted: Sat Jan 24, 2009 1:57 pm Post subject: |
|
|
Hi,
I need to create files in a directory (/data/data/package/files/directory/new_file).
I can't use ctxt.openFileOutput(path_file, Context.MODE_WORLD_READABLE), an exception is thrown :
| Quote: | | 01-24 12:29:33.496: ERROR/AndroidRuntime(14845): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.remotecontrol/org.remotecontrol.RemoteControl}: java.lang.IllegalArgumentException: File conf/menu.conf contains a path separator |
I can get the file with ctxt.getFileStreamPath(path_file); but what can I do with this ?
Thx. |
|
| Back to top |
|
 |
nuggetgtr Freshman

Joined: 06 Jan 2009 Posts: 5
|
Posted: Wed Feb 04, 2009 2:58 am Post subject: |
|
|
Umm just need a little help, I want to store a couple of variables for an application not enough to need or use a database Im just wondering what the best way to format this in a text file would be?
I was going to write each stored value line by line, and read it out the same way but i cant seam to write it line by line, it seams to append to the end of the existing line.
using the bellow code
| Java: | public void onClick(View view) {
String sov = new String(spenton.getText().toString());
try {
OutputStreamWriter out = new OutputStreamWriter(openFileOutput("spenton1.txt",MODE_APPEND));
out.write(sov +"\n");
out.close();
} |
be great if someone can point me in the right direction on the best way to store info in a file and if thats line by line how do i go about writting it line by line?
Cheers for any help |
|
| Back to top |
|
 |
citrak Once Poster

Joined: 29 Jan 2008 Posts: 1 Location: India
|
|
| Back to top |
|
 |
songotho Developer

Joined: 03 Mar 2009 Posts: 35
|
Posted: Thu Mar 12, 2009 6:09 am Post subject: |
|
|
Hi,
Thank plusminus about the Tutorials. Would you show me the way to get data from xml in sdcard?
Actually, I have read a lot of tutorials so dont have anyone show it.
Thanks.
--Alex |
|
| Back to top |
|
 |
chetandl Junior Developer

Joined: 17 Mar 2009 Posts: 16
|
Posted: Thu Mar 19, 2009 7:31 am Post subject: Image location for saving |
|
|
| Code: | @Override
public void onPictureTaken(byte[] data, Camera camera) {
try {
Bitmap image = BitmapFactory.decodeByteArray(data, 0, data.length);
FileOutputStream stream = openFileOutput("example77"+ ".png", MODE_PRIVATE);
OutputStreamWriter osw = new OutputStreamWriter(stream);
image.compress(CompressFormat.PNG, 100, stream);
stream.flush();
stream.close();
Log.v(getClass().getSimpleName(), "onPictureTaken=" + data + " length = " + data.length);
/* filoutputStream.write(data);
filoutputStream.flush();
filoutputStream.close();*/
} catch(Exception ex) {
ex.printStackTrace();
}
} |
I am trying to save an image but it saves the image in sdcard still
what may be the problem.
I want to store it in files folder of my application.
And one more thing how can I access this images for using it on ListActivity(for displaying it as images for each entry) |
|
| Back to top |
|
 |
Timmeah Junior Developer

Joined: 10 Feb 2009 Posts: 14
|
Posted: Sat Mar 21, 2009 10:12 pm Post subject: |
|
|
Does anyone how to write to a *.txt- (or XML-) file which is on a webserver?
So ftp with credentials, or just http with the chmodfile-rights at 777.. |
|
| Back to top |
|
 |
marcelloma Junior Developer

Joined: 18 Mar 2009 Posts: 12
|
Posted: Thu Mar 26, 2009 3:47 pm Post subject: |
|
|
| is there anyway to automatically scan all the objects in the drawable folder and put their ids into an array? |
|
| Back to top |
|
 |
andreleitao Experienced Developer

Joined: 10 Mar 2009 Posts: 55 Location: Recife - Brazil
|
Posted: Wed Apr 01, 2009 9:24 pm Post subject: |
|
|
Thanks for the tutorial plusminus!!! It's amazing. Buuuuttttt... I would like to know where the written file is placed. It's not become 'visible' to the programmer, right? I mean the written file is does not appear on Eclipse Package Explorer. I'm right?
Thanks  |
|
| Back to top |
|
 |
|