multithreading - Android FileOutputStream method 'ignored' -



multithreading - Android FileOutputStream method 'ignored' -

i utilize 3 files storing of local data, app, 2 of checked on app start-up , updated remotely (if newer version available or files not yet exist). 3rd user info can periodically stored while app running.

all 3 utilize same method save file:

public boolean setlocalfile(string filename, string filetext, context con) { seek { fileoutputstream fos = con.openfileoutput(filename, context.mode_private); fos.write(filetext.getbytes()); fos.close(); homecoming true; } catch(exception e) { handleerror(e); // local method system.out.println homecoming false; } }

now 3rd file writes fine, first 2 (that checked , written on start-up) don't write @ all. in debug, appears if setlocalfile method skipped without throwing exception or crashing app , error logs reported appear be:

07-11 16:14:13.162: error/androidruntime(1882): error: thread attach failed 07-11 16:14:18.882: error/gralloc(62): [unregister] handle 0x3bfe40 still locked (state=40000001)

i've not found useful online, in relation these either, unfortunately.

it's got me stumped - have no thought why it's not writing in particular case. ideas?

a belated update... giving code issue occurring not practical suspect 1 practically need of code examine fully.

my variable names began capitals largely because i've been getting java 1 time again after 10 years other languages, took me while swing of things - not pretty, surprised if have made difference. nonetheless, guys responses.

the background issue had decided handle info held in these files class objects. drafts object hold draft documents , class constructor phone call getlocalfile method , store locally in class, allowing me work (using various get/set type methods), before writing 1 time again file 'commit' method (calling setlocalfile).

there various such class objects beingness called, never more 1 instantiated each info file. stumped me working fine, except fs operation beingness ignored. 1 time accessed files straight (ignoring class wrappers i'd written) problem vanished.

the class wrappers work fine in other parts of app , problem occurred in one, complex , rather intensive, section of it.

as said, i'm getting java after extended absence (and much has changed), looking @ issue , how 'resolved' itself, guess form of thread / memory issue - accessing fs many objects , decided didn't want play anymore.

the problem, said, resolved, bugs me solution did not allow me wrap info objects more elegantly. if might suggest may cause / solution this, i'll happily seek out , study back, otherwise response may help similar problem in future - @ to the lowest degree find inelegant solution...

android multithreading fileoutputstream

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -